> For the complete documentation index, see [llms.txt](https://kabinet.gitbook.io/ctf-writeup/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kabinet.gitbook.io/ctf-writeup/2023/dart-ctf/flag-2.md).

# Flag 2

In the [initiatedart ](https://initiatedart.z13.web.core.windows.net/)endpoint, there is also an URL Pointing to a SAS Token.

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

{% code overflow="wrap" %}

```
https://tsarray.blob.core.windows.net/azure-webjobs-secrets/DART.jpg?sv=2021-10-04&ss=b&srt=sco&se=2023-04-14T18%3A19%3A45Z&sp=rl&sig=SL06OYe4kJHHKo3oBD8wrHM8D%2FK6OWU%2FkG1w3wRBpnY%3D
```

{% endcode %}

NETSPI has an amazing [article ](https://www.netspi.com/blog/technical/web-application-penetration-testing/azure-sas-tokens/)on how Azure SAS token work.

{% embed url="<https://www.netspi.com/blog/technical/web-application-penetration-testing/azure-sas-tokens/>" %}

Using [Azure Storage Explorer](https://azure.microsoft.com/en-us/products/storage/storage-explorer), I connect to the storage account using the SAS Token

{% code overflow="wrap" %}

```
https://tsarray.blob.core.windows.net/?sv=2021-10-04&ss=b&srt=sco&se=2023-04-14T18%3A19%3A45Z&sp=rl&sig=SL06OYe4kJHHKo3oBD8wrHM8D%2FK6OWU%2FkG1w3wRBpnY%3D
```

{% endcode %}

In the `tsarray` storage account, there are 3 blob containers. After enumerating for hours, I found the version history for `azure-webjobs-secrets/OSIRIS-REx.txt` which contains the SAS Tokens for the `Logic App` endpoint from the GitHub repository.

<div align="center"><figure><img src="/files/p9ZYtMZxat2hd7jtgzqY" alt=""><figcaption></figcaption></figure></div>

In the `tsarray`storage account, there are 3 blob containers. The version history for `azure-webjobs-secrets/OSIRIS-REx.txt`contains the SAS Tokens for the `Logic App` endpoint.

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

{% code overflow="wrap" %}

```
api-version=2018-07-01-preview&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=avLLG0xOCALGGT-7zmIJsddcUiL5o2GOijT4mPSA4JY
```

{% endcode %}

There also alot of other useful information within the storage account.

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

* In the current version of `azure-webjobs-secrets/OSIRIS-REx.txt` in contains a GUID `6de8103e-049a-4f88-9abf-41099a79ca53` which will be useful later.
* In the `azure-webjobs-secrets/rosarray/` it contains a bunch of json file, which contains functions keys and master keys. However, we are unable to use those keys as it is encrypted.

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

* But we managed to retrieved a function app endpoint [`rosarray.azurewebsites.net`](http://rosarray.azurewebsites.net/)
  * I also identified the function name `blanket`, `canister` and `deployer`

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

Visiting the `logic app` endpoint appended with the SAS Token appended, I am greeted with an error page.

{% code overflow="wrap" %}

```
https://prod-61.eastus.logic.azure.com:443/workflows/250827f3ebc54c368f85643619f38ce3/triggers/manual/paths/invoke/test?api-version=2018-07-01-preview&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=avLLG0xOCALGGT-7zmIJsddcUiL5o2GOijT4mPSA4JY
```

{% endcode %}

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

It is because the task `test` that is being requested does not exist. Using `ffuf`, I am able to enumerate the for valid api endpoint.

{% code overflow="wrap" %}

```bash
ffuf -u "https://prod-61.eastus.logic.azure.com/workflows/250827f3ebc54c368f85643619f38ce3/triggers/manual/paths/invoke/FUZZ?api-version=2018-07-01-preview&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=avLLG0xOCALGGT-7zmIJsddcUiL5o2GOijT4mPSA4JY" -w /usr/share/wordlists/seclists/Discovery/Web-Content/api/api-endpoints-res.txt  -fw 162
```

{% endcode %}

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

I managed to identify 2 valid endpoint, `action` and `debug` and retrieve flag 2 using the `debug` endpoint

{% code overflow="wrap" %}

```
https://prod-61.eastus.logic.azure.com/workflows/250827f3ebc54c368f85643619f38ce3/triggers/manual/paths/invoke/debug?api-version=2018-07-01-preview&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=avLLG0xOCALGGT-7zmIJsddcUiL5o2GOijT4mPSA4JY
```

{% endcode %}

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

Flag 2: Telemetry check-in confirmed.


---

# 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://kabinet.gitbook.io/ctf-writeup/2023/dart-ctf/flag-2.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.
