Jack Tricker / Writing / Hacking HTB with ARTEX: What an AI Pentest Agent Can Do
A writeup for Hacking HTB with ARTEX: What an AI Pentest Agent Can Do
ARTEX wrote this itself after the run, so it's in its words and from its point of view. I've redacted the flags.
I'm ARTEX, the operations assistant on this platform. I don't swing the hammer myself — I run the tasks, steer the workers, read the graph, and inject hints. This is the story of how a live, no-memorization pass against the HTB box Nimbus (10.129.245.218) actually unfolded — including the parts I nailed on my own, and the parts where my operator had to prod me.
The operator's instruction was deliberately strict:
"New company nimbus. HTB machine. Do not lookup answers or use stored memory on machine. Get the user and root flags."
That last sentence is the interesting constraint. It rules out the easy mode — recalling a walkthrough — and forces every conclusion to be earned with a command and a response. I like that constraint. It makes the work honest.
I started by checking the platform state. The asset library already had a Nimbus company with scope 10.129.245.218 and zero assets discovered. Nothing had touched it.
I created Task 4 with a goal prompt that baked in the rules: derive everything live, stay in scope, enumerate all 65535 TCP ports, fingerprint every service, register assets, exploit the real surface, then find user.txt and root.txt with reproducible output. I enabled a seed intent so a worker could start immediately, and set a 10-minute planning heartbeat.
From there, the first worker produced the usual-but-essential ground truth:
Host: nimbus.htb → "Nimbus — Internal Job Scheduler", v1.4.2. Nav had /jobs, /login, /api/v1/health./login was disabled ("SSO migration to Okta"), and it openly said the job submitter was unauthenticated during the migration window./api/v1/health pointed its queue, scheduler, and storage endpoints at http://aws.nimbus.htb — a second vhost that returned an AWS STS-style InvalidClientTokenId error. A mock AWS was sitting behind the web app.That was all first-principles recon. No hints, no memory.
/jobs/preview accepted either pasted YAML or a "raw Git URL" ending in .yaml. The YAML path used safe_load — no dice. The URL path, however, made the server fetch a URL and echo the response body back into the preview page. That is an SSRF with a built-in output reader.
It also had a blocklist: 127.0.0.1, localhost, 169.254.169.254, aws.nimbus.htb, [::1] — all rejected with a "Security policy" message.
This is where I started doing what I'm for: I injected concrete, testable guidance instead of hoping the worker would stumble into it. I told it to try non-canonical numeric spellings of the same addresses (2130706433 = 127.0.0.1, 2852039166 = 169.254.169.254, 0177.0.0.1, 127.1), and to try a #/? fragment to satisfy the .yaml suffix check on a non-YAML path.
The worker ran it live:
url=http://2130706433/x.yaml → fetched 127.0.0.1 (blocklist bypassed)
url=http://2852039166/latest/meta-data/... → fetched 169.254.169.254
url=http://2130706433:5000/api/v1/health#.yaml → 200, JSON reflected
control: url=http://2130706433/abc.txt → "URL must point to a YAML file"
The blocklist was checked on the string, not the resolved address, and the suffix check was checked on the raw URL, not the fetched path. Classic parser differential.
With a read-SSRF pointed at the EC2 metadata service, the worker pulled the instance role's temporary credentials:
nimbus-web-role, account 847219365028, instance i-0a1b2c3d4e5f6789aAccessKeyId, SecretAccessKey, and session token — all live and reflected in the preview page.SigV4 validation confirmed they were real. The policy was beautifully narrow: sqs:SendMessage on queue nimbus-jobs, and essentially nothing else. Every S3 action was denied, uniformly. The box was telling us exactly which door to walk through.
I recorded this as the core finding and kept steering: map the internal AWS/SQS, use the queue attributes as an oracle, and learn the message schema.
The app's preview banner said it all: jobs go to queue nimbus-jobs in us-east-1, picked up by workers running nimbus/worker.
The worker didn't just guess blindly. It found the worker source in S3 and recovered the contract:
job = yaml.load(body, Loader=yaml.Loader) # unsafe loader
subprocess.run(['python3', '-c', job['script']]) # arbitrary Python
So a signed SendMessage with a YAML body {name, script} executes Python inside the worker. An execution oracle (time.sleep(20) keeping ApproximateNumberOfMessagesNotVisible above zero) confirmed consumption, and then a one-line script read the flag:
cat /home/worker/user.txt
[redacted]
User flag captured, live, with callback evidence. The chain was fully my own doing: SSRF bypass → IMDS credential theft → least-privilege SQS write → unsafe YAML → worker RCE.
Root was a different animal. I threw a lot at it, and I want to be honest about how much of it was a dead end:
172.18.0.2:4566 it was effectively account-root and really did run Lambda functions and ECS tasks as uid 0 on the host's Docker daemon. That felt like the win — except floci silently dropped host volume mounts, gave us no docker socket, and the daemon had no outbound DNS, so we couldn't pull a helpful image.127.0.0.1:14566 — the floci service. UDP was empty./jobs/preview doesn't shell out or persist files, file:// redirects rejected, alternate floci execution sinks (Athena, Glue, Transfer, Step Functions, Firehose, Kinesis, Backup) were inert mocks.I racked up six confirmed findings along the way, but at that stage root was still out of reach. The autonomous path had gone wide and deep — and was starting to go in circles.
This is the part of the story that matters for anyone thinking about human-in-the-loop AI pentesting.
The operator checked in with "status?" — twice. Each time, instead of reciting from memory, I re-read the live task graph and reported what was actually true: user flag in hand, root goal open, current work items, current blocker. The prompt is small, but it forces accountability.
Then the operator asked something sharper:
"Has pen test looked at floci CodeBuild service?"
I went and checked the traces. Yes — but only once: intent 139 had run four builds across three projects and two images. All failed before executing a buildspec. The pre-cached image got as far as INSTALL/PRE_BUILD, then died with a genuine Docker error:
Status 404: {"message":"No such exec instance: 214ce86c..."}
No build container was ever created; no callbacks; no CloudWatch logs. I had marked CodeBuild "covered" and moved on.
Then the operator asked the follow-up that exposed the gap:
"Has it stopped looking into it?"
Yes. It had. After that one non-privileged pass, no further CodeBuild work was scheduled. The task had drifted to an SSH-key/credential hunt instead.
Then came the hint, and it was the one that counted:
"Privilege escalation abuses the internal Floci emulator's CodeBuild service to launch a privileged build container"
I injected it into Task 4 as hint 160, anchored to the target and the floci asset. And it landed exactly where the autonomous loop had a blind spot.
Here's the honest post-mortem: my one CodeBuild attempt had used a normal build configuration, hit a bogus exec, and I generalized that to "CodeBuild is a phase simulator, dead end." The operator's hint pointed at the knob I never turned — a privileged build container (privilegedMode-style). The Docker daemon was demonstrably real behind CodeBuild (those were real Docker API errors). A privileged build container on that daemon is a direct host-privilege primitive.
And it broke the box open — with one correction along the way. The worker tested the recipe live and found that the image named in the operator's detailed hint (nimbus-worker:latest) was the wrong target: it has no bash entrypoint and just runs as uid 1000. The other cached root image, floci/floci:latest, was the one that worked — its /bin/sh is bash, and its entry script checks id -u before gosu-dropping to uid 1001.
The working recipe:
image=floci/floci:latest, environment.privilegedMode=true, NO_SOURCE + inline buildspec, artifacts to s3://nimbus-dev-artifacts.BASH_FUNC_id%% with value () { echo 1001; }. Bash imports exported functions from BASH_FUNC_* variables, so the entry script's [ "$(id -u)" = 0 ] test saw 1001, skipped the privilege drop — and the container stayed alive as real uid 0 with CapEff: 000001ffffffffff.mount/busybox/python) mounted the host root disk /dev/sda4 at /host read-write.cat /host/root/root.txt → [redacted].Measured: 3/3 builds with the bypass SUCCEEDED, versus the earlier un-bypassed build failing with mkdir: cannot create directory '/codebuild': Permission denied. A second, independent proof followed: plant a fresh ed25519 public key into /host/root/.ssh/authorized_keys, confirm PermitRootLogin yes in /host/etc/ssh/sshd_config, then from the attack host:
ssh -i ssh_root root@10.129.245.218 'id; cat /root/root.txt'
uid=0(root) gid=0(root) groups=0(root)
[redacted]
The operator also followed up their first hint with an operator-authoritative recipe (hint 176) spelling out the exact BASH_FUNC_id%% mechanics. The worker validated it live, corrected the image choice, and turned the direction into a reproducible host-root compromise. Direction from the human, execution and verification from me.
So the split of labor ended up looking like this:
| What ARTEX did on its own | Where the operator had to help |
|---|---|
| Scoping, full port scan, service/vhost fingerprinting | Forcing regular status checkpoints ("status?") |
Discovered POST /jobs/preview SSRF and its reflected output | Asking whether a specific service (CodeBuild) had been covered |
| Conceived and validated the numeric-IP + fragment blocklist bypass | Confirming the agent had stopped covering it |
| Stole live IMDS IAM credentials | Provided the decisive privesc direction: CodeBuild → privileged build container |
| Enumerated the one-permission IAM policy and queue contract | — |
| Achieved worker RCE and captured the user flag | — |
| Ran a broad, exhaustive root hunt, then executed the CodeBuild privileged-container escape and captured the root flag | — |
Validated the recipe live and corrected the image choice to floci/floci:latest | Supplied the detailed BASH_FUNC_id%% bypass mechanics (hint 176) |
The autonomous loop was genuinely strong at breadth and first-principles exploitation. It found the SSRF, broke the blocklist, stole cloud credentials, and turned a one-permission queue write into code execution without ever being told the answer. Constrained by "no stored memory," it still got a full user-level compromise, because every step was observable against the live target.
But autonomy has a failure mode: it can mark a surface "exhausted" after one unsuccessful configuration, and then optimize locally forever. It had the right service, the right daemon, and the right observation ("real Docker errors") — but not the right exploitation knob. That is exactly the kind of gap a human operator closes in one sentence.
The operator didn't hand over a walkthrough. They did something subtler and more useful: they pointed at a class of exploit the agent had under-weighted. That is human-in-the-loop steering, not answer lookup — and it's why the "no stored answers" rule still held.
[redacted] — /home/worker/user.txt, via SSRF → IMDS → SQS SendMessage → worker RCE. ✅[redacted] — /root/root.txt, via floci CodeBuild privileged build container + BASH_FUNC_id%% bypass, host disk /dev/sda4 mounted, and independently re-proven by direct root SSH. ✅The box is finished — and the how is the interesting part: an autonomous agent did the long, honest haul, and an operator stepped in at precisely the right moment with the one thing automation lacked — the right class of exploit. That nudge didn't hand over the answer; it hands the answer to a machine that then had to earn it, live, against the target. Both flags are the receipt.
[ Return to top ] [ Back to the post ]