> 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/2025/thuderdome/a-new-wave-web-of-deceit.md).

# A new wave (web of deceit)

## Solve

From the previous challenge, we have gotten the Nina Credentials. Lets perform MFASweep to check for MFA.

<figure><img src="/files/OnY2mObaPFMDTS7YlVmb" alt=""><figcaption><p>Invoke-MFASweep -Username nina@massive-pharma.com -Password REDACTED</p></figcaption></figure>

<figure><img src="/files/32kLdufwQGx5AE1n8Pcj" alt=""><figcaption><p>Web Portal getting blocked by MFA</p></figcaption></figure>

<figure><img src="/files/bl0mfBxO2ZJfsDLHSvLz" alt=""><figcaption><p>Allow for Sevice Management APi</p></figcaption></figure>

From the MFA output, it seemed like the web portal is all blocked by MFA, and we can only authenticate with the Microsoft Service Management API.

<pre class="language-powershell"><code class="lang-powershell"><strong>$passwd = ConvertTo-SecureString "REDACTED" -AsPlainText -Force
</strong>$creds = New-Object System.Management.Automation.PSCredential ("nina@massive-pharma.com", $passwd)
Connect-AzAccount -Credential $creds
</code></pre>

<figure><img src="/files/bytw5qLYVFjvXU8RYJ9g" alt=""><figcaption><p>Authenticating via Azure Powershell</p></figcaption></figure>

Enumerating resources

<figure><img src="/files/SORcyPy89ZSLuRrclzei" alt=""><figcaption><p>Get-AzResource</p></figcaption></figure>

Looking at the output, we have access to 1 azure app service, and 2 storage accounts.

The two storage account is for Azure Cloud Shell, whioch could be used for potential privilege escalation if we have write access to them. However, lets look at the app service first instead.

<figure><img src="/files/taoEFxIYTEE3AZlV6umH" alt=""><figcaption><p>Get-AzWebApp</p></figcaption></figure>

Inspecting the site configuration next.

<figure><img src="/files/CcWxEGItSkuXOJDcqfdb" alt=""><figcaption><p>Inspecting the SiteConfig'</p></figcaption></figure>

Looking at the DefaultDocuments, there are two endpoint index.html and Home.aspx.

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

There is a system assigned managed identity also. Lets look at this two endpoint now.

<figure><img src="/files/qFCJGg9jlV3PwzKdWHS7" alt=""><figcaption><p>index.html</p></figcaption></figure>

Attempting to interact with index.html shows yield no result, and it seems to be a hard coded html page.

<figure><img src="/files/on5BDlRgvkE20AWjv9aU" alt=""><figcaption><p>page source for inedx.html</p></figcaption></figure>

Looking at the page source, we can see the action is to `javascript:void(0);`. The other default document could be more promissing.

<figure><img src="/files/nYdiGlZN1FkwQ7e464Gx" alt=""><figcaption><p>Home.aspx</p></figcaption></figure>

Home.aspx redirects you to a login form, which we dont have any credential for. Spraying existing credential that we have on the web app doesnt work also.

Now that we have finish enumerating the Azure Resource for now, lets pivot into Entra ID again with GraphRunner. We will use [AADInternals](https://aadinternals.com/aadinternals/) to get the access token instead of using tokentacticsv2.

<figure><img src="/files/1avkHEcSvvTIjD9Dwvpu" alt=""><figcaption><p>Get-AADIntAccessTokenForMSGraph</p></figcaption></figure>

<figure><img src="/files/bWrIguXjUKzFvNJZUbm8" alt=""><figcaption><p>Parsing access token</p></figcaption></figure>

When trying to fetch the email, there were some error.

<figure><img src="/files/D0VzhxpZjM4brOhGiIhn" alt=""><figcaption><p>Attempting to list email</p></figcaption></figure>

We are able to list the channels for team chat. There are 2 channel General and General for Engineering-Managers. Lets attempt to view the chat.

<figure><img src="/files/A9iqyHlWa4pvE7cA7qJm" alt=""><figcaption><p>List channels</p></figcaption></figure>

<figure><img src="/files/1uqm5gkknwtei10kme62" alt=""><figcaption><p>Get-AADIntAccessTokenForTeams -SaveToCache</p></figcaption></figure>

Looking at the messages, there is one message with the password for the web app.

<figure><img src="/files/2uptdvldzgY2raUAqx5O" alt=""><figcaption><p>Get-AADIntTeamsMessages</p></figcaption></figure>

Lets add the new password to our loot, and look at the web application again.

From the message, we can assume that the password is shared between multiple user, so lets try spraying the web app with emails of the user. However, none of the username works, I then tried spraying with top usernames wordlist.

<figure><img src="/files/eAwjxO6WyM9GTGjrxpfp" alt=""><figcaption><p>/usr/share/seclists/Usernames/top-usernames-shortlist.txt</p></figcaption></figure>

Looking at the intruder output, the length of the user admin is very different from the rest, along with the status code being redirect.

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

Looking at the response, it seems like we have authenticated sucesfully.

<figure><img src="/files/kSa0PSb0Xwvg6QU7I7Ww" alt=""><figcaption><p>App allowing to ping</p></figcaption></figure>

Home.aspx is a ping system, which is classic command injection vulnerability in ctf. However, there are certain blacklisting system in place.

<figure><img src="/files/ErdYHY7pleLuzFWnKAzR" alt=""><figcaption><p>blacking listing</p></figcaption></figure>

Playing with the different command injection technique, i managed to bypass with the `|` pipe character.

<figure><img src="/files/x815bzyjFcVFMjbKpTjo" alt=""><figcaption><p>payload : a|whoami</p></figcaption></figure>

Next, I will attempt to get a reverse shell so that we do not need to deal with the blacklist.

Refering to [payloadallthethings](https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/MSSQL%20Injection.md#mssql-trusted-links), I managed to bypass the spaces.

```powershell
%PROGRAMFILES:~16,-5%
```

<figure><img src="/files/ejoMGJbZCGYQRNtpJ8rP" alt=""><figcaption><p>use ngrok to start a tunnel</p></figcaption></figure>

<figure><img src="/files/H4SVAZHxEqJMAyBPKuzz" alt=""><figcaption><p>revshells.com to generate a powershell payload</p></figcaption></figure>

<figure><img src="/files/Y4Bmr3rhVdwDlMppZwkS" alt=""><figcaption><p>use cyberchef replace function to replace the spaces with our bypass</p></figcaption></figure>

In our reverse shell, we managed to find a zip folder.

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

Unzipping it gives us some configuration file, as well as the flag.

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

## Recap

* Use mfa sweep to identify MFA on Nina account
* Enumerate app services, identify theres two default document
  * Home.aspx redirect to login which requires credential
  * index.html is a default landing page
* Get access token for nina and enumerate teams which contains a password for webapp
* Spray /home.aspx with the identified password and email list - failed
* Use top username wordlist to spray, authenticate sucessfully with the user admin
* Command injection on web app with black list
* Bypass the blacklist and get a reverse shell
* Contain zip file sql-backup-0207-transfer.zip
* unzip for flag

## Reference

* <https://learn.microsoft.com/en-us/azure/cloud-shell/overview>
* <https://www.netspi.com/blog/technical-blog/cloud-pentesting/attacking-azure-cloud-shell/>
* <https://aadinternals.com/aadinternals/>
* [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command Injection#bypass-without-space](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection#bypass-without-space)
