Machine / Machines

Cobblestone

Cobblestone is a sanitized machine note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator

InsanePublished 2025-12-06Sanitized local writeup

Scenario

Cobblestone attack path

Cobblestone is a sanitized machine note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator

Objective

Machine walkthrough focused on Machines evidence, validation, and reusable operator lessons.

Cobblestone sanitized attack graph

Walkthrough flow

01

External scan exposed only SSH and HTTP.

02

HTTP vhosts included cobblestone.htb, vote, deploy,...

03

vote app had authenticated second-order SQL injection...

04

SQL () was useful for source/config recovery, but...

05

Source review of the main app found stored XSS in...

Source coverage

High source coverage

Status: complete. This article is generated from 7 sanitized Markdown sources and keeps raw flags, credentials, keys, cookies, and reusable secrets out of the rendered blog.

100% coverage
Evidence verdict

High confidence: the page is reconstructed from a primary walkthrough plus multiple supporting notes or evidence sources. Treat the chain as source-backed, while still checking the listed source files for sensitive values.

  • <TARGET>-Cobblestone/walkthrough.md
  • HTB/<TARGET>-Cobblestone/notes.md
  • HTB/<TARGET>-Cobblestone/attack-map.md
  • HTB/<TARGET>-Cobblestone/memory-summary.md
  • HTB/<TARGET>-Cobblestone/session-resume.md
  • HTB/<TARGET>-Cobblestone/custom-exploit-notes.md
  • HTB/<TARGET>-Cobblestone/dead-ends.md

Technical Walkthrough

Cobblestone Walkthrough

This file will be written from live evidence as the engagement progresses. Public research is not evidence until reproduced against the live target.

Phase 0 - Setup

  • Workspace created.
  • Memory files loaded: MEMORY.md, htb_web_attack_patterns.md, htb_quick_wins.md, htb_file_transfer_tunneling.md, htb_hard_insane_state.md, htb_lightrag_context.md.
  • Start-of-case LightRAG query completed.

Phase 1 - Validation Gate

Matched core public anchors:

  • Full TCP scan found only 22/tcp and 80/tcp.
  • HTTP service redirects direct IP traffic to cobblestone.htb.
  • Service scan identifies OpenSSH 9.2p1 Debian and Apache 2.4.62 on Debian.
  • Base page links deploy.cobblestone.htb, vote.cobblestone.htb, and mc.cobblestone.htb.
  • Vhost fuzzing confirmed vote and deploy; mc redirects to base and is linked from the page.
  • vote exposes login/register and authenticated suggest.php.

The advisory chain is valid enough to proceed, but SQL injection and file-write/RCE are not evidence yet.

Phase 2 - Vote SQLi And Source Recovery

  • Registered a controlled vote account and validated authenticated access to suggest.php.
  • Confirmed second-order SQL injection in vote.cobblestone.htb/suggest.php POST url, triggered through details.php.
  • Enumerated DBMS context: MariaDB, current DB vote, current user voteuser@localhost, and global FILE privilege.
  • Used SQL file-read to recover Apache vhost config and PHP/Twig source for both vote and main cobblestone.htb.
  • Rejected SQL file-write after live checks showed @@secure_file_priv as NULL; this made the public FILE-write webshell path stale for this instance.

Phase 3 - Main App XSS To Twig SSTI

  • Source review identified:

- suggest_skin.php: authenticated users can insert skin suggestions.

- templates/suggest.html.twig: suggestion fields are rendered with | raw.

- preview_banner.php: admin-only endpoint renders attacker input through Twig::createTemplate().

  • Submitted a harmless stored-XSS callback and confirmed the admin reviewer executed it.
  • Proved the Twig sink with {{7*7}}, which rendered as 49.
  • Proved command execution as www-data using Twig filters such as filter('system').

Phase 4 - Stable User Foothold

  • Public advisory credential for cobble was treated as a hypothesis and validated live over SSH.
  • Captured user flag from the live target and stored it in loot/user.txt.
  • Confirmed cobble is constrained by restricted rbash/jail behavior, but SSH port forwarding still works.

Phase 5 - Cobbler Root

  • Created SSH local forward from Pwnbox <TARGET>:25151 to target <TARGET>:25151.
  • Confirmed Cobbler XML-RPC version 3.3.6.
  • Used Cobbler XML-RPC auth bypass to obtain an admin-capable token.
  • Created controlled cdx_* Cobbler distro/profile/autoinstall template objects.
  • Rendered a Cheetah autoinstall template that executed a root command and returned output.
  • Captured root flag from live root execution and stored it in loot/root.txt.

Source-Backed Dossier

The sections below are merged from companion Markdown notes for the same case. They are rendered after sanitization so the article stays precise without publishing raw flags, credentials, or target-specific secrets.

Notes

Scope

  • Platform: HackTheBox Machine
  • Target: <TARGET>
  • Name: Cobblestone
  • OS: Linux
  • Difficulty: Insane
  • Creator: c1sc0
  • Pwnbox: profex0r@<TARGET>
  • Started: 2026-05-07 AEST
  • Rules: Public pre-research and LightRAG are advisory only. Live target evidence is source of truth. Store raw flags/secrets in loot/ only.

Evidence Ledger

TimestampCommand / ActionOutput FileFindingConfidenceNext Action
2026-05-07Workspace initialized; memory and advisory research loadednotes.md, research.md, attack-map.md, session-resume.mdInsane state files created before touching targetHighVerify Pwnbox/VPN and run validation gate
2026-05-07Pwnbox baseline over SSHremote inline, scope.txtPwnbox SSH works; VPN IP <TARGET>/23; target reachable by ICMP; key tools present: nmap, curl, ffuf, whatweb, sqlmap, mysql, tmux, python3HighRun live TCP/HTTP validation gate
2026-05-07Full TCP scannmap/allports.txtOnly 22/tcp and 80/tcp openHighService scan and HTTP validation
2026-05-07Service scannmap/service-22-80.txt22 OpenSSH 9.2p1 Debian; 80 Apache 2.4.62, redirect to cobblestone.htbHighValidate vhosts
2026-05-07HTTP/vhost validationenum/http-known-vhosts.txt, enum/ffuf-vhosts.jsoncobblestone.htb, vote, deploy, mc all live/linked; vote and deploy found by ffufHighValidate vote workflow
2026-05-07Vote workflow checkenum/vote-known-paths.txt, enum/ffuf-vote-dirs.jsonlogin.php, register.php, suggest.php, details.php, db/, vendor/, templates/ discovered; suggest.php requires authHighRegister test user and inspect authenticated workflow
2026-05-07Authenticated SQLi validationenum/sqlmap-suggest-url.txtsuggest.php POST url is second-order SQLi, 5-column UNION, boolean/time-based; DBMS MariaDBHighEnumerate DB context and file capabilities
2026-05-07DB/file-read/source validationenum/sqlmap-db-context.txt, loot/sqlmap-users-query.txt, enum/sqlmap-file-read-batch-summary.txtDB user voteuser@localhost, DB vote, not DBA; file-read works; Apache config and PHP source recovered; users include admin with bcrypt hashHighTest controlled file-write proof
2026-05-07SQL FILE-write and secure_file_priv validationenum/outfile-variant-summary.txt, enum/union-securefile-details.html, dead-ends.mdAutomated and manual INTO OUTFILE attempts did not create a web shell; live union probe showed secure_file_priv is NULLHighPivot away from SQL file-write to main app stored-XSS path
2026-05-07Main app source review via SQL file-readenum/sqlmap-suggest/vote.cobblestone.htb/files/_var_www_html_preview_banner.php, enum/sqlmap-suggest/vote.cobblestone.htb/files/_var_www_html_suggest_skin.phpAuthenticated users can plant raw suggestions; admin-only preview_banner.php renders attacker-controlled Twig via createTemplate()HighValidate admin review and SSTI execution
2026-05-07Stored XSS admin review validationlogs/xss-callback-8001.log, enum/main-xss-ssti-probe-status.txtAdmin reviewer executed stored JavaScript from suggestions; Twig probe rendered {{7*7}} as 49HighUse admin session to trigger Twig command execution
2026-05-07Twig command execution validationlogs/xss-callback-8001.logfilter('system') and map('system') executed id as www-data through preview_banner.phpHighStabilize foothold or validate SSH credential path
2026-05-07SSH foothold validationenum/cobble-ssh-validation.txt, enum/cobble-rbash-probes.txt, loot/<password redacted>cobble SSH credential validated live; shell is restricted rbash/jail; user flag captured and stored in loot/user.txtHighEstablish SSH local forward to Cobbler
2026-05-07Cobbler XML-RPC exploitationenum/cobbler-version.xml, enum/cobbler-render-root.redacted.txt, exploits/cobbler_render_exec.pySSH forward reached Cobbler 3.3.6; XML-RPC auth bypass allowed rendering a Cheetah template as root; root flag stored in loot/root.txtHighCleanup and write final summary

Pre-Research Validation Gate

Public ClaimStatusEvidenceNotes
Only SSH and HTTP exposed externallyMATCHEDnmap/allports.txt22/tcp, 80/tcp only
HTTP redirects or resolves to cobblestone.htbMATCHEDenum/http-ip-index-timeout.txt, nmap/service-22-80.txtDirect IP redirects to http://cobblestone.htb/
Vhosts: deploy, vote, mcMATCHEDenum/http-known-vhosts.txt, enum/ffuf-vhosts.jsonvote and deploy discovered by ffuf; mc linked from base page and redirects to base
vote app permits registration and has suggestion flowMATCHEDenum/vote-known-paths.txt, enum/ffuf-vote-dirs.jsonLogin/register form exists; suggest.php discovered and redirects when unauthenticated
SQL injection can lead to file read/write or web executionPARTIALenum/sqlmap-file-read-batch-summary.txt, enum/outfile-variant-summary.txt, enum/union-securefile-details.htmlFile read matched; file write/web execution did not because live secure_file_priv is NULL
Main app stored XSS and Twig SSTI chainMATCHEDlogs/xss-callback-8001.log, preview_banner.php, suggest_skin.phpAdmin review plus Twig createTemplate() gave www-data command execution
Local Cobbler XML-RPC on <TARGET>:25151 after footholdMATCHEDenum/cobbler-version.xml, enum/cobbler-render-root.redacted.txtSSH local forward confirmed Cobbler 3.3.6 and root-level template rendering

Current Status

  • Access: root achieved through Cobbler XML-RPC template rendering.
  • Active tunnels/listeners: Pwnbox tmux cobble:tunnel, cobble:callback, and cobble:shell were used during exploitation; no further interaction required.
  • Flags: user and root captured from live target and stored under loot/.

Attack Map

Hosts

IPHostnameOSStatusReachable From
<TARGET>unknownLinux (claimed)In scopePwnbox
<TARGET>cobblestone.htbDebian/LinuxLivePwnbox
<TARGET>vote.cobblestone.htbDebian/LinuxLivePwnbox
<TARGET>deploy.cobblestone.htbDebian/LinuxLivePwnbox
<TARGET>mc.cobblestone.htbDebian/LinuxLivePwnbox

Services

HostPortServiceVersionAuthNotes
<TARGET>22SSHOpenSSH 9.2p1 Debian 2+deb12u7unknownExternal
<TARGET>80HTTPApache 2.4.62 Debianapp auth on voteBase redirects to cobblestone.htb; vhosts identified
vote.cobblestone.htb80PHP web appBilly template 1.9.2login/registersuggest.php, details.php, db/, vendor/
cobblestone.htb80PHP/Twig web appBilly template 1.9.2login/registerStored XSS in suggestions; admin-only Twig preview sink
<TARGET>25151Cobbler XML-RPC3.3.6bypassedReached through SSH local forward as cobble

Credentials

SourceUsernameSecretTypeTested OnResult
Public advisory, live validatedcobbleStored in loot/<password redacted>SSH password<TARGET>:22Success, restricted shell

Attack Paths

#PathStatusEvidence
1HTTP vhost -> vote app -> SQLi file-read -> source review -> main app stored XSS -> Twig SSTI as www-datavalidatedenum/sqlmap-suggest-url.txt, preview_banner.php, logs/xss-callback-8001.log
2Advisory credential -> live SSH as cobble -> SSH local forward -> Cobbler XML-RPC auth bypass -> Cheetah template render as rootcompleteenum/cobble-ssh-validation.txt, enum/cobbler-version.xml, enum/cobbler-render-root.redacted.txt
3SQLi INTO OUTFILE web shellrejectedenum/outfile-variant-summary.txt, enum/union-securefile-details.html

Trust Edges

None yet.

Memory Summary

Status: Pending user approval before ingestion.

Metadata

  • Platform: HackTheBox
  • Content type: Machine
  • Name: Cobblestone
  • OS: Linux
  • Difficulty: Insane
  • Workspace: <local workspace><TARGET>-Cobblestone

Verified Chain

  1. External scan exposed only SSH and HTTP.
  2. HTTP vhosts included cobblestone.htb, vote, deploy, and mc.
  3. vote app had authenticated second-order SQL injection through stored url values rendered by details.php.
  4. SQL <secret redacted>() was useful for source/config recovery, but INTO OUTFILE was blocked on the live instance because secure_file_priv resolved to NULL.
  5. Source review of the main app found stored XSS in user-submitted skin suggestions and an admin-only Twig createTemplate() sink in preview_banner.php.
  6. Stored XSS executed in an admin reviewer session and triggered Twig SSTI as www-data.
  7. A live-validated SSH credential gave access as cobble, restricted by rbash/jail behavior.
  8. SSH local forwarding exposed Cobbler XML-RPC on <TARGET>:25151.
  9. Cobbler 3.3.6 XML-RPC auth bypass plus Cheetah autoinstall rendering produced root command execution.

Reusable Lessons

  • Treat public SQL file-write chains as volatile: validate @@secure_file_priv early and pivot if export is disabled.
  • Source-read from SQLi can be more valuable than shell upload on Insane Linux web chains.
  • For stored-XSS admin bots, use a short external script loader instead of trying to fit long JavaScript into application fields.
  • If a browser-based payload navigates away too early, serve callback endpoints with HTTP 204 to keep the page active.
  • rbash may block interactive command execution but still permit SSH local forwarding, which is enough for internal-only services.
  • Cobbler XML-RPC exploitation can avoid reverse shells by rendering command output directly through Cheetah templates.

Do Not Ingest

  • Raw flags
  • Raw <password redacted>
  • Cookies
  • Full callback logs containing transient session artifacts

Session Resume

Last updated: 2026-05-07 AEST

Current Access

  • User flag and root flag captured from the live target and stored in loot/.
  • Validated SSH as cobble with credential stored in loot/<password redacted>; shell is restricted rbash/jail.
  • Root achieved through Cobbler XML-RPC on <TARGET>:25151 via SSH local forward.

Session Registry

NameHostCommandPaneLocal PortRemote TargetStatus
callbackPwnboxpython3 -u exploits/callback_204_server.pycobble:callback8001stored-XSS callbacksStopped after solve
tunnelPwnboxssh -N -L <TARGET>:25151:<TARGET>:25151 cobble@<TARGET>cobble:tunnel25151target Cobbler XML-RPCStopped after solve
shellPwnboxnc -lnvp 9002cobble:shell9002attempted reverse shellStopped after solve

Next Three Actions

  1. Optional cleanup: remove stored XSS suggestion rows and cdx_* Cobbler objects if desired.
  2. Write post-solve sanitized memory summary for approval before LightRAG ingestion.
  3. Keep memory-summary.md out of LightRAG until user approves ingestion.

Blockers

  • SQL INTO OUTFILE path was stale/blocked by secure_file_priv=NULL; documented in dead-ends.md.

Cleanup

  • Stored XSS suggestion rows were created.
  • Cobbler cdx_* distro/profile/template objects were created.

Notes

Track exploit scripts, payload versions, state mutations, and rollback commands here.

State Mutations

TimestampTargetAttribute / FileOld ValueNew ValueRollback
2026-05-07Webroot via SQLi FILE write/var/www/html/cdx_<random>.php or /var/www/vote/cdx_<random>.phpDid not existHarmless PHP proof marker if write succeedsDelete proof file after foothold/root, or overwrite with empty if delete unavailable
2026-05-07Main app suggestions tableNew suggestion rowsDid not existStored XSS probes and loader rowsRemove rows from suggestions table if DB access is available
2026-05-07Cobbler XML-RPCNew distro/profile/template objectsDid not existcdx_* distro/profile/autoinstall template objectsRemove cdx_* Cobbler objects through XML-RPC if cleanup is required

Exploit Iterations

TimestampFilePurposeExpectedObservedNext
2026-05-07exploits/write_vote_webshell.shManual second-order UNION ... INTO OUTFILE webshell attemptPHP file in /var/www/voteFailed; live secure_file_priv was NULLRejected path
2026-05-07exploits/main_xss_ssti_probe.sh / main_xss_ssti_submit_short.shValidate stored XSS and admin-only Twig SSTIAdmin browser renders Twig payload and exfiltrates result{{7*7}} rendered to 49; id executed as www-dataFoothold path validated
2026-05-07exploits/cobbler_render_exec.pyExploit Cobbler XML-RPC auth bypass and template renderingRoot command output through rendered autoinstall templateid ran as root and root flag was storedComplete

Dead Ends

SQLi FILE Write To Webroot

  • Evidence: enum/outfile-variant-summary.txt, enum/sqlmap-file-write-proof-summary.txt, enum/sqlmap-file-write-alias-summary.txt
  • Result: Automated sqlmap writes and manual UNION ... INTO OUTFILE variants did not create a reachable PHP file.
  • Root cause: live union probe showed @@secure_file_priv resolves to NULL, so read via <secret redacted>() worked but export/write was blocked.
  • Decision: Treat public writeup FILE-write claims as stale for this live instance and pivot to source-assisted main-app XSS/SSTI.

Reverse Shell Through Twig

  • Evidence: logs/xss-callback-8001.log, logs/www-data-shell-9002.log
  • Result: Twig command execution worked, but reverse-shell payloads were unreliable through the admin bot queue and field-length constraints.
  • Decision: Prefer stable SSH credential validation and Cobbler API exploitation over continuing to fight browser-driven shell orchestration.