Secret of Meow Olympurr
Last updated
Last updated
Category: Cloud Difficulty: Medium Tags: AWS, Azure
From the challenge description, I identified a few key information
There are misconfiguration in the cloud configuration
It is a multi-cloud configuration, with two environment
To get the flag, I will need to invoke a function
I am also given the URL to a AWS CloudFront
Visiting the URL shows a website with alot of cute cats, and it also reminds me of CloudyNekos
from TISC 2022
Viewing the source code of the website does not reveal any useful information, however when visiting the error page, it shows some interesting information.
The image src is http://18.141.147.115:8080/https://meowolympurr.z23.web.core.windows.net/images/ohno.jpg
which made me suspect that it is a possible remote file inclusion (RFI) vector, and I went down a really long rabbit hole of enumerating and trying to exploit the RFO.
I first identified the API that is running at http://18.141.147.115:8080
is Cors_anywhere
I am also able to visit http://18.141.147.115:8080/http://169.254.169.254/latest/meta-data
and extract the credentials at http://18.141.147.115:8080/http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance
However, after spending hours enumerating with the credentials, I was unable to proceed anywhere. I revisited this http://18.141.147.115:8080/https://meowolympurr.z23.web.core.windows.net/images/ohno.jpg
url, and I realized that I missed out on the glaringly obvious Azure URL Syntax.
I double check my suspicion by visiting Microsoft documentation and identified that it is an Azure DNS zone endpoints
.
Visiting https://meowolympurr.z23.web.core.windows.net/
shows the exact page as the AWS CloudFront end point, with an extra endpoint pointing to Azure Function App (which we will revisit in later steps), however things get interesting again when visiting the error page.
When visiting view-source:https://meowolympurr.z23.web.core.windows.net/asd
it shows a SAS Key for Azure Storage Account, and I connected to the storage account with Microsoft Azure Storage Explorer.
💡 SAS (Shared Access Signature) key is a string of characters that allows access to a specific Azure storage account resource. SAS keys are typically used to grant access to resources in a storage account to users or applications that do not have direct access to the storage account key. The SAS key provides a secure and flexible way to grant access to storage account resources without giving users or applications access to the storage account key.
I used the GUI application Microsoft Azure Storage Explorer
Upon connecting to the storage account with the SAS, it shows that there are 3 blobs containers.
Looking at the dev
container shows a readme.md
file which shows hints to continue the challenge.
The readme.md
gave a few key information.
Tenant ID
Application ID
Client Secret
Function Application Endpoint
SAS token for the scm-releases
container
Using the application id
and client secret
I am able to login with the service principal
, which has the same privileges as the function app. I will be using az powershell, as I am more familiar with it.
💡 An Azure service principal is a security identity that is used by applications or services to access resources in Azure. It is similar to a user identity, but is specific to applications or services, and can be used to grant permissions to access Azure resources
Connecting with the Azure using powershell
For the Get-Credential
cmdlets, put the application id
as username, and client secret
as password
Since the readme.md
above gave a SAS key
I will first try and enumerate storage account with the Get-AzStorageAccount
cmdlet.
As suspected, there is another storage account called meowvellousappstorage
and I am able to connect to the scm-releases
container with the SAS in the readme.
In the scm-releases
container, it shows a zip file scm-latest-olympurr-app.zip
which is the source code of the Azure Function enumerated previously.
Extracting the source code with unsquashfs identify a few information.
An AWS key with the key name of AKIA5G4XMRW7TLT6XD7R
An Lamba Function with the function name event-webservice
In the function logURL
it shows the lambda function getting a managed identity
and connecting to Azure Key Vault
to retrieve a secret key.
💡 Azure managed identity is a feature of Azure Active Directory that allows an Azure resource, such as a virtual machine, to be authenticated and authorized to access other Azure resources.
Since we knew that the service principal
we are connected has the same permission as the managed identity, I am able to directly call the Get-AzKeyVaultSecret
cmdlet to retrieve the AWS secret.
💡 Azure Key Vault is a cloud-based service for securely storing and managing cryptographic keys and secrets.
Using AWS cli, I am able to login with the set of access key and secret access key
Using the tool pacu, I am able to enumerate my user permission.
I am able to identified the allow permissions.
Since we have the logs:DescribeLogGroups
permission set, lets try running that first
There are quite a few log groups, however two of them caught my eyes.
The /aws/lambda/event-webservice
was the function name identified in the source code from scm-releases
and
/aws/lambda/internal-secret-of-MeowOlympurr-webservice
seems to reveal the secrets (flag).
Recall from the function application
source code that the IAM user is able to invoke a lambda function, despite it not being reflected in the permission enumerated from pacu.
I attempted to invoke the internal-secret-of-MeowOlympurr-webservice
and I am given the flag.
Flag: STF22{LIveInTh3Me0wmen7_:3}
The challenge is a nice step above Cloudy Nekos
from TISC. It covers misconfiguration in a multi-cloud environment, testing participants capability in enumerating services in both AWS and Azure.
ps the cats were really cute